���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /home/real/node-v13.0.1/test/parallel/ |
'use strict'; const common = require('../common'); if (common.isWindows) { // No way to send CTRL_C_EVENT to processes from JS right now. common.skip('platform not supported'); } if (!common.isMainThread) common.skip('No signal handling available in Workers'); const assert = require('assert'); const spawn = require('child_process').spawn; process.env.REPL_TEST_PPID = process.pid; const child = spawn(process.execPath, [ '-i' ], { stdio: [null, null, 2] }); let stdout = ''; child.stdout.setEncoding('utf8'); child.stdout.on('data', function(c) { stdout += c; }); child.stdout.once('data', common.mustCall(() => { process.on('SIGUSR2', common.mustCall(() => { process.kill(child.pid, 'SIGINT'); child.stdout.once('data', common.mustCall(() => { // Make sure state from before the interruption is still available. child.stdin.end('a*2*3*7\n'); })); })); child.stdin.write('a = 1001;' + 'process.kill(+process.env.REPL_TEST_PPID, "SIGUSR2");' + 'while(true){}\n'); })); child.on('close', function(code) { assert.strictEqual(code, 0); const expected = 'Script execution was interrupted by `SIGINT`'; assert.ok( stdout.includes(expected), `Expected stdout to contain "${expected}", got ${stdout}` ); assert.ok( stdout.includes('42042\n'), `Expected stdout to contain "42042", got ${stdout}` ); });