From 325a1bcaf0ed70ef2de52c145b2c40b2b246f8f8 Mon Sep 17 00:00:00 2001 From: Pekka Laiho Date: Fri, 19 Jun 2020 19:20:31 +0700 Subject: [PATCH] save history also for failed commands in repl --- run.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/run.php b/run.php index a966d4f..0e2d7b1 100644 --- a/run.php +++ b/run.php @@ -18,11 +18,6 @@ function ml_repl($lisp) try { $lisp->rep($input, true); - - if ($input) { - readline_add_history($input); - readline_write_history($historyFile); - } } catch (MadLisp\MadLispException $ex) { print('error: ' . $ex->getMessage()); } catch (TypeError $ex) { @@ -30,6 +25,11 @@ function ml_repl($lisp) } print(PHP_EOL); + + if ($input) { + readline_add_history($input); + readline_write_history($historyFile); + } } }