summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index 778fad12..8212fdd7 100644
--- a/parser.c
+++ b/parser.c
@@ -1376,8 +1376,14 @@ val repl(val bindings, val in_stream, val out_stream)
dyn_env = saved_dyn_env;
- if (histfile_w)
- lino_hist_save(ls, histfile_w);
+ if (histfile_w) {
+ val histfile_tmp = format(nil, lit("~a/.txr_history.tmp"), home, nao);
+ if (lino_hist_save(ls, c_str(histfile_tmp)) == 0)
+ rename_path(histfile_tmp, histfile);
+ else
+ put_line(lit("** unable to save history file"), out_stream);
+ gc_hint(histfile_tmp);
+ }
free(line_w);
lino_free(ls);