We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eadc385 commit 3eea43aCopy full SHA for 3eea43a
1 file changed
lib/internal/repl/history.js
@@ -93,6 +93,7 @@ function setupHistory(repl, historyPath, ready) {
93
fs.ftruncate(hnd, 0, (err) => {
94
repl._historyHandle = hnd;
95
repl.on('line', online);
96
+ repl.once('exit', onexit);
97
98
// Reading the file data out erases it
99
repl.once('flushHistory', function() {
@@ -137,6 +138,15 @@ function setupHistory(repl, historyPath, ready) {
137
138
}
139
140
141
+
142
+ function onexit() {
143
+ if (repl._flushing) {
144
+ repl.once('flushHistory', onexit);
145
+ return;
146
+ }
147
+ repl.off('line', online);
148
+ fs.close(repl._historyHandle, () => {});
149
150
151
152
function _replHistoryMessage() {
0 commit comments