| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,6 +93,7 @@ function setupHistory(repl, historyPath, ready) { | |||
| 93 | 93 | fs.ftruncate(hnd, 0, (err) => { | |
| 94 | 94 | repl._historyHandle = hnd; | |
| 95 | 95 | repl.on('line', online); | |
| 96 | + repl.once('exit', onexit); | ||
| 96 | 97 | ||
| 97 | 98 | // Reading the file data out erases it | |
| 98 | 99 | repl.once('flushHistory', function() { | |
@@ -137,6 +138,15 @@ function setupHistory(repl, historyPath, ready) { | |||
| 137 | 138 | } | |
| 138 | 139 | } | |
| 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 | + } | ||
| 140 | 150 | } | |
| 141 | 151 | ||
| 142 | 152 | function _replHistoryMessage() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments