Skip to content

Commit 9b35f92

Browse files
KristofferCDilumAluthge
authored andcommitted
tweak lock for non files
1 parent 281a039 commit 9b35f92

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
@@ -651,10 +651,15 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
651651
# If this doesn't fix it (e.g. when file is deleted), we'll end up rethrowing anyway
652652
hist_open_file(hist)
653653
end
654-
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
654+
if isfile(hist.file_path)
655+
FileWatching.mkpidlock(hist.file_path * ".pid", stale_age=3) do
656+
print(hist.history_file, entry)
657+
flush(hist.history_file)
658+
end
659+
else # handle eg devnull
655660
print(hist.history_file, entry)
656661
flush(hist.history_file)
657-
end
662+
end
658663
nothing
659664
end
660665

0 commit comments

Comments
 (0)