Skip to content
Permalink
Browse files

Fix for R#2758

Make sure the history file is created if it doesn't exist yet.
  • Loading branch information...
lizmat committed Apr 26, 2019
1 parent 9ce1792 commit cb691da514a499dcae722f911ab832c220d026f1
Showing with 12 additions and 9 deletions.
  1. +12 −9 src/core/REPL.pm6
@@ -405,17 +405,20 @@ do {
}

method history-file(--> Str:D) {
return $!history-file.absolute if $!history-file.defined;

$!history-file = $*ENV<RAKUDO_HIST>
?? $*ENV<RAKUDO_HIST>.IO
!! ($*HOME || $*TMPDIR).add('.perl6/rakudo-history');

without mkdir $!history-file.parent {
note "I ran into a problem trying to set up history: {.exception.message}";
note 'Sorry, but history will not be saved at the end of your session';
without $!history-file {
$!history-file = $*ENV<RAKUDO_HIST>
?? $*ENV<RAKUDO_HIST>.IO
!! ($*HOME || $*TMPDIR).add('.perl6/rakudo-history');

without mkdir $!history-file.parent {
note "I ran into a problem trying to set up history: {.exception.message}";
note 'Sorry, but history will not be saved at the end of your session';
}
}

# make sure there is a history file
$!history-file.open(:a).close unless $!history-file.e;

$!history-file.absolute
}
}

0 comments on commit cb691da

Please sign in to comment.
You can’t perform that action at this time.