1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Fix 'Error: EBADF: bad file descriptor, write' on .exit in REPL

Fixes issue #4252.
This commit is contained in:
Ben Buckman 2016-04-14 09:24:21 -07:00 committed by Michael Ficarra
parent 88192c197a
commit 7c2f348a63
2 changed files with 2 additions and 2 deletions

View file

@ -138,7 +138,7 @@
} catch (error) {}
fd = fs.openSync(filename, 'a');
repl.rli.addListener('line', function(code) {
if (code && code.length && code !== '.history' && lastLine !== code) {
if (code && code.length && code !== '.history' && code !== '.exit' && lastLine !== code) {
fs.write(fd, code + "\n");
return lastLine = code;
}

View file

@ -121,7 +121,7 @@ addHistory = (repl, filename, maxSize) ->
fd = fs.openSync filename, 'a'
repl.rli.addListener 'line', (code) ->
if code and code.length and code isnt '.history' and lastLine isnt code
if code and code.length and code isnt '.history' and code isnt '.exit' and lastLine isnt code
# Save the latest command in the file
fs.write fd, "#{code}\n"
lastLine = code