xref: /third_party/node/test/parallel/test-process-ppid.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst cp = require('child_process');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') {
71cb0ef41Sopenharmony_ci  // The following console.log() call is part of the test's functionality.
81cb0ef41Sopenharmony_ci  console.log(process.ppid);
91cb0ef41Sopenharmony_ci} else {
101cb0ef41Sopenharmony_ci  const child = cp.spawnSync(process.execPath, [__filename, 'child']);
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci  assert.strictEqual(child.status, 0);
131cb0ef41Sopenharmony_ci  assert.strictEqual(child.signal, null);
141cb0ef41Sopenharmony_ci  assert.strictEqual(+child.stdout.toString().trim(), process.pid);
151cb0ef41Sopenharmony_ci  assert.strictEqual(child.stderr.toString().trim(), '');
161cb0ef41Sopenharmony_ci}
17

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