xref: /third_party/node/test/parallel/test-stdin-script-child-option.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciconst expected = '--option-to-be-seen-on-child';
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst { spawn } = require('child_process');
81cb0ef41Sopenharmony_ciconst child = spawn(process.execPath, ['-', expected], { stdio: 'pipe' });
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cichild.stdin.end('console.log(process.argv[2])');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cilet actual = '';
131cb0ef41Sopenharmony_cichild.stdout.setEncoding('utf8');
141cb0ef41Sopenharmony_cichild.stdout.on('data', (chunk) => actual += chunk);
151cb0ef41Sopenharmony_cichild.stdout.on('end', common.mustCall(() => {
161cb0ef41Sopenharmony_ci  assert.strictEqual(actual.trim(), expected);
171cb0ef41Sopenharmony_ci}));
18

Indexes created Thu Nov 07 10:32:03 CST 2024