Skip to content

Commit a5a3f82

Browse files
KristofferCmbauman
authored andcommitted
tweak lock for non files
1 parent bc1c7bb commit a5a3f82

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,15 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
671671
# If this doesn't fix it (e.g. when file is deleted), we'll end up rethrowing anyway
672672
hist_open_file(hist)
673673
end
674-
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
674+
if isfile(hist.file_path)
675+
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
676+
print(hist.history_file, entry)
677+
flush(hist.history_file)
678+
end
679+
else # handle eg devnull
675680
print(hist.history_file, entry)
676681
flush(hist.history_file)
677-
end
682+
end
678683
nothing
679684
end
680685

0 commit comments

Comments
 (0)