1'use strict'; 2 3// This is a regression test for https://github.com/joyent/node/issues/8874. 4 5require('../common'); 6const assert = require('assert'); 7 8const spawn = require('child_process').spawn; 9// Use -i to force node into interactive mode, despite stdout not being a TTY 10const args = [ '-i' ]; 11const child = spawn(process.execPath, args); 12 13const input = 'const foo = "bar\\\nbaz"'; 14// Match '...' as well since it marks a multi-line statement 15const expectOut = /> \.\.\. undefined\n/; 16 17child.stderr.setEncoding('utf8'); 18child.stderr.on('data', (d) => { 19 throw new Error('child.stderr be silent'); 20}); 21 22child.stdout.setEncoding('utf8'); 23let out = ''; 24child.stdout.on('data', (d) => { 25 out += d; 26}); 27 28child.stdout.on('end', () => { 29 assert(expectOut.test(out)); 30 console.log('ok'); 31}); 32 33child.stdin.end(input); 34