Merge pull request #3952 from sixmen/fix_write_after_fin

fix write after FIN error when using repl via socket
This commit is contained in:
Michael Ficarra
2015-04-23 06:45:04 -07:00
2 changed files with 4 additions and 2 deletions

View File

@@ -185,7 +185,9 @@
runInContext(opts.prelude, repl.context, 'prelude');
}
repl.on('exit', function() {
return repl.outputStream.write('\n');
if (!repl.rli.closed) {
return repl.outputStream.write('\n');
}
});
addMultilineHandler(repl);
if (opts.historyFile) {

View File

@@ -152,7 +152,7 @@ module.exports =
opts = merge replDefaults, opts
repl = nodeREPL.start opts
runInContext opts.prelude, repl.context, 'prelude' if opts.prelude
repl.on 'exit', -> repl.outputStream.write '\n'
repl.on 'exit', -> repl.outputStream.write '\n' if not repl.rli.closed
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize if opts.historyFile
# Adapt help inherited from the node REPL