xref: /third_party/node/test/parallel/test-child-process-send-cb.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_ciconst fork = require('child_process').fork;
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') {
71cb0ef41Sopenharmony_ci  process.send('ok', common.mustCall((err) => {
81cb0ef41Sopenharmony_ci    assert.strictEqual(err, null);
91cb0ef41Sopenharmony_ci  }));
101cb0ef41Sopenharmony_ci} else {
111cb0ef41Sopenharmony_ci  const child = fork(process.argv[1], ['child']);
121cb0ef41Sopenharmony_ci  child.on('message', common.mustCall((message) => {
131cb0ef41Sopenharmony_ci    assert.strictEqual(message, 'ok');
141cb0ef41Sopenharmony_ci  }));
151cb0ef41Sopenharmony_ci  child.on('exit', common.mustCall((exitCode, signalCode) => {
161cb0ef41Sopenharmony_ci    assert.strictEqual(exitCode, 0);
171cb0ef41Sopenharmony_ci    assert.strictEqual(signalCode, null);
181cb0ef41Sopenharmony_ci  }));
191cb0ef41Sopenharmony_ci}
20

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