11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciif (common.isWindows) 71cb0ef41Sopenharmony_ci common.skip('Sending signals with process.kill is not supported on Windows'); 81cb0ef41Sopenharmony_ciif (!common.isMainThread) 91cb0ef41Sopenharmony_ci common.skip('No signal handling available in Workers'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciprocess.once('SIGINT', common.mustCall((signal) => { 121cb0ef41Sopenharmony_ci assert.strictEqual(signal, 'SIGINT'); 131cb0ef41Sopenharmony_ci})); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciprocess.kill(process.pid, 'SIGINT'); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciprocess.once('SIGTERM', common.mustCall((signal) => { 181cb0ef41Sopenharmony_ci assert.strictEqual(signal, 'SIGTERM'); 191cb0ef41Sopenharmony_ci})); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ciprocess.kill(process.pid, 'SIGTERM'); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci// Prevent Node.js from exiting due to empty event loop before signal handlers 241cb0ef41Sopenharmony_ci// are fired 251cb0ef41Sopenharmony_cisetImmediate(() => {}); 26