Skip to content

Commit cfb73b2

Browse files
committed
tweak lock for non files
1 parent 9a5b7b4 commit cfb73b2

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
@@ -625,10 +625,15 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
625625
# If this doesn't fix it (e.g. when file is deleted), we'll end up rethrowing anyway
626626
hist_open_file(hist)
627627
end
628-
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
628+
if isfile(hist.file_path)
629+
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
630+
print(hist.history_file, entry)
631+
flush(hist.history_file)
632+
end
633+
else # handle eg devnull
629634
print(hist.history_file, entry)
630635
flush(hist.history_file)
631-
end
636+
end
632637
nothing
633638
end
634639

0 commit comments

Comments
 (0)