| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 37b9372 commit e0c4f0b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ function run(flags, signals) { | |||
| 21 | 21 | child.on('exit', common.mustCall(function(code, sig) { | |
| 22 | 22 | if (common.isWindows) { | |
| 23 | 23 | if (signals) | |
| 24 | - assert.strictEqual(code, 3); | ||
| 24 | + assert.strictEqual(code, 0xC0000005); | ||
| 25 | 25 | else | |
| 26 | 26 | assert.strictEqual(code, 1); | |
| 27 | 27 | } else { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,28 +1,33 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | const common = require('../common'); | |
| 3 | 3 | const assert = require('assert'); | |
| 4 | - const http = require('http'); | ||
| 5 | - const spawn = require('child_process').spawn; | ||
| 4 | + const { createServer, get } = require('http'); | ||
| 5 | + const { spawn } = require('child_process'); | ||
| 6 | 6 | ||
| 7 | 7 | if (process.argv[2] === 'child') { | |
| 8 | - const server = http.createServer(common.mustCall((req, res) => { | ||
| 9 | - res.end('hello'); | ||
| 10 | - })); | ||
| 11 | - | ||
| 8 | + // sub-process | ||
| 9 | + const server = createServer(common.mustCall((_, res) => res.end('h'))); | ||
| 12 | 10 | server.listen(0, common.mustCall((s) => { | |
| 13 | - const rr = http.get( | ||
| 14 | - { port: server.address().port }, | ||
| 15 | - common.mustCall((d) => { | ||
| 16 | - // This bad input (0) should abort the parser and the process | ||
| 17 | - rr.parser.consume(0); | ||
| 18 | - server.close(); | ||
| 19 | - })); | ||
| 11 | + const rr = get({ port: server.address().port }, common.mustCall(() => { | ||
| 12 | + // This bad input (0) should abort the parser and the process | ||
| 13 | + rr.parser.consume(0); | ||
| 14 | + // This line should be unreachanble. | ||
| 15 | + assert.fail('this should be unreachable'); | ||
| 16 | + })); | ||
| 20 | 17 | })); | |
| 21 | 18 | } else { | |
| 22 | - const child = spawn(process.execPath, [__filename, 'child'], | ||
| 23 | - { stdio: 'inherit' }); | ||
| 19 | + // super-proces | ||
| 20 | + const child = spawn(process.execPath, [__filename, 'child']); | ||
| 21 | + child.stdout.on('data', common.mustNotCall()); | ||
| 22 | + | ||
| 23 | + let stderr = ''; | ||
| 24 | + child.stderr.on('data', common.mustCallAtLeast((data) => { | ||
| 25 | + assert(Buffer.isBuffer(data)); | ||
| 26 | + stderr += data.toString('utf8'); | ||
| 27 | + }, 1)); | ||
| 24 | 28 | child.on('exit', common.mustCall((code, signal) => { | |
| 25 | - assert(common.nodeProcessAborted(code, signal), | ||
| 26 | - 'process should have aborted, but did not'); | ||
| 29 | + assert(stderr.includes('failed'), `stderr: ${stderr}`); | ||
| 30 | + const didAbort = common.nodeProcessAborted(code, signal); | ||
| 31 | + assert(didAbort, `process did not abort, code:${code} signal:${signal}`); | ||
| 27 | 32 | })); | |
| 28 | 33 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,8 +58,8 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok | |||
| 58 | 58 | if /i "%1"=="noetw" set noetw=1&goto arg-ok | |
| 59 | 59 | if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok | |
| 60 | 60 | if /i "%1"=="licensertf" set licensertf=1&goto arg-ok | |
| 61 | - if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons -J&set lint_cpp=1&set lint_js=1&set build_addons=1&goto arg-ok | ||
| 62 | - if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok | ||
| 61 | + if /i "%1"=="test" set test_args=%test_args% abort doctool known_issues message parallel sequential addons -J&set lint_cpp=1&set lint_js=1&set build_addons=1&goto arg-ok | ||
| 62 | + if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap abort doctool inspector known_issues message sequential parallel addons&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&goto arg-ok | ||
| 63 | 63 | if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok | |
| 64 | 64 | if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok | |
| 65 | 65 | if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok | |
| Back | FazBrowse Home | New Git URL |
0 commit comments