File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
33version = " 1.11.0"
44
55[deps ]
6+ FileWatching = " 7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
67InteractiveUtils = " b77e0a4c-d291-57a0-90e8-8db25a27a240"
78JuliaSyntaxHighlighting = " ac6e5ff7-fb65-4e79-a425-ec3bc9c03011"
89Markdown = " d6f4376e-aef5-505a-96c1-9c027394607a"
Original file line number Diff line number Diff line change 4141using Base. Meta, Sockets, StyledStrings
4242using JuliaSyntaxHighlighting
4343import InteractiveUtils
44+ import FileWatching
4445
4546export
4647 AbstractREPL,
@@ -927,7 +928,6 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
927928 # mode: $mode
928929 $(replace (str, r" ^" ms => " \t " ))
929930 """
930- # TODO : write-lock history file
931931 try
932932 seekend (hist. history_file)
933933 catch err
@@ -936,8 +936,15 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
936936 # If this doesn't fix it (e.g. when file is deleted), we'll end up rethrowing anyway
937937 hist_open_file (hist)
938938 end
939- print (hist. history_file, entry)
940- flush (hist. history_file)
939+ if isfile (hist. file_path)
940+ FileWatching. mkpidlock (hist. file_path * " .pid" , stale_age= 3 ) do
941+ print (hist. history_file, entry)
942+ flush (hist. history_file)
943+ end
944+ else # handle eg devnull
945+ print (hist. history_file, entry)
946+ flush (hist. history_file)
947+ end
941948 nothing
942949end
943950
You can’t perform that action at this time.
0 commit comments