mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
623 B
25 lines
623 B
10 years ago
|
'use strict';
|
||
13 years ago
|
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!');
|
||
10 years ago
|
}, common.platformTimeout(1000)); // give node + the repl 1 second to boot up
|
||
13 years ago
|
|
||
|
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);
|
||
|
});
|