| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9feee1f commit 65d1e02
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,7 +70,7 @@ if (process.argv[2] !== 'child') { | |||
| 70 | 70 | TIMEOUT); | |
| 71 | 71 | console.error('[PARENT] Fail'); | |
| 72 | 72 | ||
| 73 | - killChildren(workers); | ||
| 73 | + killSubprocesses(workers); | ||
| 74 | 74 | ||
| 75 | 75 | process.exit(1); | |
| 76 | 76 | }, TIMEOUT); | |
@@ -102,7 +102,7 @@ if (process.argv[2] !== 'child') { | |||
| 102 | 102 | console.error('[PARENT] All workers have died.'); | |
| 103 | 103 | console.error('[PARENT] Fail'); | |
| 104 | 104 | ||
| 105 | - killChildren(workers); | ||
| 105 | + killSubprocesses(workers); | ||
| 106 | 106 | ||
| 107 | 107 | process.exit(1); | |
| 108 | 108 | } | |
@@ -155,7 +155,7 @@ if (process.argv[2] !== 'child') { | |||
| 155 | 155 | ||
| 156 | 156 | clearTimeout(timer); | |
| 157 | 157 | console.error('[PARENT] Success'); | |
| 158 | - killChildren(workers); | ||
| 158 | + killSubprocesses(workers); | ||
| 159 | 159 | } | |
| 160 | 160 | } | |
| 161 | 161 | }); | |
@@ -203,10 +203,10 @@ if (process.argv[2] !== 'child') { | |||
| 203 | 203 | ); | |
| 204 | 204 | }; | |
| 205 | 205 | ||
| 206 | - function killChildren(children) { | ||
| 207 | - Object.keys(children).forEach(function(key) { | ||
| 208 | - const child = children[key]; | ||
| 209 | - child.kill(); | ||
| 206 | + function killSubprocesses(subprocesses) { | ||
| 207 | + Object.keys(subprocesses).forEach(function(key) { | ||
| 208 | + const subprocess = subprocesses[key]; | ||
| 209 | + subprocess.kill(); | ||
| 210 | 210 | }); | |
| 211 | 211 | } | |
| 212 | 212 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,16 +116,16 @@ function launchChildProcess() { | |||
| 116 | 116 | ||
| 117 | 117 | clearTimeout(timer); | |
| 118 | 118 | console.error('[PARENT] Success'); | |
| 119 | - killChildren(workers); | ||
| 119 | + killSubprocesses(workers); | ||
| 120 | 120 | } | |
| 121 | 121 | } | |
| 122 | 122 | }); | |
| 123 | 123 | } | |
| 124 | 124 | ||
| 125 | - function killChildren(children) { | ||
| 126 | - Object.keys(children).forEach(function(key) { | ||
| 127 | - const child = children[key]; | ||
| 128 | - child.kill(); | ||
| 125 | + function killSubprocesses(subprocesses) { | ||
| 126 | + Object.keys(subprocesses).forEach(function(key) { | ||
| 127 | + const subprocess = subprocesses[key]; | ||
| 128 | + subprocess.kill(); | ||
| 129 | 129 | }); | |
| 130 | 130 | } | |
| 131 | 131 | ||
@@ -141,7 +141,7 @@ if (process.argv[2] !== 'child') { | |||
| 141 | 141 | TIMEOUT); | |
| 142 | 142 | console.error('[PARENT] Fail'); | |
| 143 | 143 | ||
| 144 | - killChildren(workers); | ||
| 144 | + killSubprocesses(workers); | ||
| 145 | 145 | ||
| 146 | 146 | process.exit(1); | |
| 147 | 147 | }, TIMEOUT); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,7 +89,7 @@ if (process.argv[2] !== 'child') { | |||
| 89 | 89 | TIMEOUT); | |
| 90 | 90 | console.error('[PARENT] Skip'); | |
| 91 | 91 | ||
| 92 | - killChildren(workers); | ||
| 92 | + killSubprocesses(workers); | ||
| 93 | 93 | common.skip('Check filter policy'); | |
| 94 | 94 | ||
| 95 | 95 | process.exit(1); | |
@@ -132,7 +132,7 @@ if (process.argv[2] !== 'child') { | |||
| 132 | 132 | console.error('[PARENT] All workers have died.'); | |
| 133 | 133 | console.error('[PARENT] Fail'); | |
| 134 | 134 | ||
| 135 | - killChildren(workers); | ||
| 135 | + killSubprocesses(workers); | ||
| 136 | 136 | ||
| 137 | 137 | process.exit(1); | |
| 138 | 138 | } | |
@@ -187,7 +187,7 @@ if (process.argv[2] !== 'child') { | |||
| 187 | 187 | ||
| 188 | 188 | clearTimeout(timer); | |
| 189 | 189 | console.error('[PARENT] Success'); | |
| 190 | - killChildren(workers); | ||
| 190 | + killSubprocesses(workers); | ||
| 191 | 191 | } | |
| 192 | 192 | } | |
| 193 | 193 | }); | |
@@ -239,9 +239,9 @@ if (process.argv[2] !== 'child') { | |||
| 239 | 239 | ); | |
| 240 | 240 | }; | |
| 241 | 241 | ||
| 242 | - function killChildren(children) { | ||
| 243 | - for (const i in children) | ||
| 244 | - children[i].kill(); | ||
| 242 | + function killSubprocesses(subprocesses) { | ||
| 243 | + for (const i in subprocesses) | ||
| 244 | + subprocesses[i].kill(); | ||
| 245 | 245 | } | |
| 246 | 246 | } | |
| 247 | 247 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -122,7 +122,7 @@ if (process.argv[2] === 'child') { | |||
| 122 | 122 | while (j--) { | |
| 123 | 123 | const client = net.connect(this.address().port, '127.0.0.1'); | |
| 124 | 124 | client.on('error', function() { | |
| 125 | - // This can happen if we kill the child too early. | ||
| 125 | + // This can happen if we kill the subprocess too early. | ||
| 126 | 126 | // The client should still get a close event afterwards. | |
| 127 | 127 | console.error('[m] CLIENT: error event'); | |
| 128 | 128 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,7 +53,7 @@ function test() { | |||
| 53 | 53 | function next() { | |
| 54 | 54 | console.error('output from parent = %s', json); | |
| 55 | 55 | const child = JSON.parse(json); | |
| 56 | - // now make sure that we can request to the child, then kill it. | ||
| 56 | + // now make sure that we can request to the subprocess, then kill it. | ||
| 57 | 57 | http.get({ | |
| 58 | 58 | server: 'localhost', | |
| 59 | 59 | port: child.port, | |
@@ -64,7 +64,7 @@ function test() { | |||
| 64 | 64 | s += c.toString(); | |
| 65 | 65 | }); | |
| 66 | 66 | res.on('end', function() { | |
| 67 | - // kill the child before we start doing asserts. | ||
| 67 | + // kill the subprocess before we start doing asserts. | ||
| 68 | 68 | // it's really annoying when tests leave orphans! | |
| 69 | 69 | process.kill(child.pid, 'SIGKILL'); | |
| 70 | 70 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,7 +53,7 @@ function test() { | |||
| 53 | 53 | function next() { | |
| 54 | 54 | console.error('output from parent = %s', json); | |
| 55 | 55 | const child = JSON.parse(json); | |
| 56 | - // now make sure that we can request to the child, then kill it. | ||
| 56 | + // now make sure that we can request to the subprocess, then kill it. | ||
| 57 | 57 | http.get({ | |
| 58 | 58 | server: 'localhost', | |
| 59 | 59 | port: child.port, | |
@@ -64,7 +64,7 @@ function test() { | |||
| 64 | 64 | s += c.toString(); | |
| 65 | 65 | }); | |
| 66 | 66 | res.on('end', function() { | |
| 67 | - // kill the child before we start doing asserts. | ||
| 67 | + // kill the subprocess before we start doing asserts. | ||
| 68 | 68 | // it's really annoying when tests leave orphans! | |
| 69 | 69 | process.kill(child.pid, 'SIGKILL'); | |
| 70 | 70 | try { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,7 @@ process.on('exit', function() { | |||
| 44 | 44 | // concurrency in HTTP servers! Use the cluster module, or if you want | |
| 45 | 45 | // a more low-level approach, use child process IPC manually. | |
| 46 | 46 | test(function(child, port) { | |
| 47 | - // now make sure that we can request to the child, then kill it. | ||
| 47 | + // now make sure that we can request to the subprocess, then kill it. | ||
| 48 | 48 | http.get({ | |
| 49 | 49 | server: 'localhost', | |
| 50 | 50 | port: port, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,8 +58,8 @@ if (process.argv[2] === 'child') { | |||
| 58 | 58 | const child = fork(process.argv[1], ['child']); | |
| 59 | 59 | ||
| 60 | 60 | child.on('exit', function(code, signal) { | |
| 61 | - if (!childKilled) | ||
| 62 | - throw new Error('child died unexpectedly!'); | ||
| 61 | + if (!subprocessKilled) | ||
| 62 | + throw new Error('subprocess died unexpectedly!'); | ||
| 63 | 63 | }); | |
| 64 | 64 | ||
| 65 | 65 | const server = net.createServer(); | |
@@ -86,10 +86,10 @@ if (process.argv[2] === 'child') { | |||
| 86 | 86 | } | |
| 87 | 87 | }); | |
| 88 | 88 | ||
| 89 | - let childKilled = false; | ||
| 89 | + let subprocessKilled = false; | ||
| 90 | 90 | function closeSockets(i) { | |
| 91 | 91 | if (i === count) { | |
| 92 | - childKilled = true; | ||
| 92 | + subprocessKilled = true; | ||
| 93 | 93 | server.close(); | |
| 94 | 94 | child.kill(); | |
| 95 | 95 | return; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments