mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/6090 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Fixes: https://github.com/nodejs/node/issues/2895v6.x
Rich Trott
9 years ago
committed by
James M Snell
5 changed files with 82 additions and 23 deletions
@ -0,0 +1,7 @@ |
|||
var a = 1; |
|||
|
|||
var b = 2; |
|||
|
|||
var c = 3; |
|||
|
|||
b = c; |
@ -0,0 +1,46 @@ |
|||
'use strict'; |
|||
const path = require('path'); |
|||
const spawn = require('child_process').spawn; |
|||
const assert = require('assert'); |
|||
|
|||
const common = require('../common'); |
|||
|
|||
const fixture = path.join( |
|||
common.fixturesDir, |
|||
'debugger-repeat-last.js' |
|||
); |
|||
|
|||
const args = [ |
|||
'debug', |
|||
fixture |
|||
]; |
|||
|
|||
const proc = spawn(process.execPath, args, { stdio: 'pipe' }); |
|||
proc.stdout.setEncoding('utf8'); |
|||
|
|||
var stdout = ''; |
|||
|
|||
var sentCommand = false; |
|||
var sentEmpty = false; |
|||
var sentExit = false; |
|||
|
|||
proc.stdout.on('data', (data) => { |
|||
stdout += data; |
|||
if (!sentCommand && stdout.includes('> 1')) { |
|||
setImmediate(() => {proc.stdin.write('n\n');}); |
|||
return sentCommand = true; |
|||
} |
|||
if (!sentEmpty && stdout.includes('> 3')) { |
|||
setImmediate(() => {proc.stdin.write('\n');}); |
|||
return sentEmpty = true; |
|||
} |
|||
if (!sentExit && sentCommand && sentEmpty) { |
|||
setTimeout(() => {proc.stdin.write('\n\n\n.exit\n\n\n');}, 1); |
|||
return sentExit = true; |
|||
} |
|||
}); |
|||
|
|||
process.on('exit', (exitCode) => { |
|||
assert.strictEqual(exitCode, 0); |
|||
console.log(stdout); |
|||
}); |
Loading…
Reference in new issue