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"
3
3
version = " 1.11.0"
4
4
5
5
[deps ]
6
+ FileWatching = " 7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
6
7
InteractiveUtils = " b77e0a4c-d291-57a0-90e8-8db25a27a240"
7
8
JuliaSyntaxHighlighting = " ac6e5ff7-fb65-4e79-a425-ec3bc9c03011"
8
9
Markdown = " d6f4376e-aef5-505a-96c1-9c027394607a"
Original file line number Diff line number Diff line change 41
41
using Base. Meta, Sockets, StyledStrings
42
42
using JuliaSyntaxHighlighting
43
43
import InteractiveUtils
44
+ import FileWatching
44
45
45
46
export
46
47
AbstractREPL,
@@ -927,7 +928,6 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
927
928
# mode: $mode
928
929
$(replace (str, r" ^" ms => " \t " ))
929
930
"""
930
- # TODO : write-lock history file
931
931
try
932
932
seekend (hist. history_file)
933
933
catch err
@@ -936,8 +936,15 @@ function add_history(hist::REPLHistoryProvider, s::PromptState)
936
936
# If this doesn't fix it (e.g. when file is deleted), we'll end up rethrowing anyway
937
937
hist_open_file (hist)
938
938
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
941
948
nothing
942
949
end
943
950
You can’t perform that action at this time.
0 commit comments