blob: f2c65583b3656be0c5d9c72fd04063dbe24eace7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
const os = require('os');
var args = [
'-e',
'var e = new (require("repl")).REPLServer("foo.. "); e.context.e = e;',
];
var p = 'bar.. ';
var child = spawn(process.execPath, args);
child.stdout.setEncoding('utf8');
var data = '';
child.stdout.on('data', function(d) { data += d; });
child.stdin.end(`e.setPrompt("${p}");${os.EOL}`);
child.on('close', function(code, signal) {
assert.strictEqual(code, 0);
assert.ok(!signal);
var lines = data.split(/\n/);
assert.strictEqual(lines.pop(), p);
});
|