2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2012-03-21 08:05:25 +01:00
|
|
|
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!');
|
2015-04-07 20:41:07 +02:00
|
|
|
}, common.platformTimeout(1000)); // give node + the repl 1 second to boot up
|
2012-03-21 08:05:25 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|