Files
node/test/sequential/test-force-repl.js
isaacs 3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00

24 lines
585 B
JavaScript

var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
// spawn a node child process in "interactive" mode (force the repl)
var cp = spawn(process.execPath, ['-i']);
var gotToEnd = false;
var timeoutId = setTimeout(function() {
throw new Error('timeout!');
}, 1000); // give node + the repl 1 second to boot up
cp.stdout.setEncoding('utf8');
cp.stdout.once('data', function(b) {
clearTimeout(timeoutId);
assert.equal(b, '> ');
gotToEnd = true;
cp.kill();
});
process.on('exit', function() {
assert(gotToEnd);
});