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:
parent
88192c197a
commit
7c2f348a63
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue