-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repl: support hidden history file on Windows #12207
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,10 +164,19 @@ function setupHistory(repl, historyPath, oldHistoryPath, ready) { | |
} | ||
} | ||
|
||
fs.open(historyPath, 'w', onhandle); | ||
fs.open(historyPath, 'r+', onhandle); | ||
} | ||
|
||
function onhandle(err, hnd) { | ||
if (err) { | ||
return ready(err); | ||
} | ||
fs.ftruncate(hnd, 0, (err) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I am gathering, the mode change no longer cause overwrites (appends instead) and so we need to "flush" the file? From the docs though, it sounds like it does writes and not appends, so this shouldn't be necessary?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous implementation cleared the file once when opening it with |
||
return onftruncate(err, hnd); | ||
}); | ||
} | ||
|
||
function onftruncate(err, hnd) { | ||
if (err) { | ||
return ready(err); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break creating a new file if none exists? [1]