11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// Spawn a node child process in interactive mode (enabling the REPL) and 71cb0ef41Sopenharmony_ci// confirm the '> ' prompt and welcome message is included in the output. 81cb0ef41Sopenharmony_ciconst cp = spawn(process.execPath, ['-i']); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cicp.stdout.setEncoding('utf8'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cilet out = ''; 131cb0ef41Sopenharmony_cicp.stdout.on('data', (d) => { 141cb0ef41Sopenharmony_ci out += d; 151cb0ef41Sopenharmony_ci}); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cicp.stdout.on('end', common.mustCall(() => { 181cb0ef41Sopenharmony_ci assert.strictEqual(out, `Welcome to Node.js ${process.version}.\n` + 191cb0ef41Sopenharmony_ci 'Type ".help" for more information.\n> '); 201cb0ef41Sopenharmony_ci})); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_cicp.stdin.end(''); 23