Move lastLine setter into conditional block to prevent .commands and blank lines from setting lastLine

This commit is contained in:
Daniel G. Taylor
2013-04-07 11:28:59 -07:00
parent feaea49eac
commit 0e2d2ea637
2 changed files with 2 additions and 2 deletions

View File

@@ -115,8 +115,8 @@
repl.rli.addListener('line', function(code) {
if (code && code.length && code !== '.history' && lastLine !== code) {
fs.write(fd, "" + code + "\n");
return lastLine = code;
}
return lastLine = code;
});
process.on('exit', function() {
return fs.closeSync(fd);

View File

@@ -106,7 +106,7 @@ addHistory = (repl, filename, maxSize) ->
if code and code.length and code isnt '.history' and lastLine isnt code
# Save the latest command in the file
fs.write fd, "#{code}\n"
lastLine = code
lastLine = code
process.on 'exit', ->
fs.closeSync fd