| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9c96d7f commit fa8315c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,27 +1,21 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - require('../common'); | ||
| 2 | + const { mustCall } = require('../common'); | ||
| 3 | 3 | const assert = require('assert'); | |
| 4 | - const spawn = require('child_process').spawn; | ||
| 4 | + const { spawn } = require('child_process'); | ||
| 5 | 5 | ||
| 6 | 6 | const cat = spawn('cat'); | |
| 7 | - let called; | ||
| 8 | 7 | ||
| 9 | 8 | assert.ok(process.kill(cat.pid, 0)); | |
| 10 | 9 | ||
| 11 | - cat.on('exit', function() { | ||
| 10 | + cat.on('exit', mustCall(function() { | ||
| 12 | 11 | assert.throws(function() { | |
| 13 | 12 | process.kill(cat.pid, 0); | |
| 14 | 13 | }, Error); | |
| 15 | - }); | ||
| 14 | + })); | ||
| 16 | 15 | ||
| 17 | - cat.stdout.on('data', function() { | ||
| 18 | - called = true; | ||
| 16 | + cat.stdout.on('data', mustCall(function() { | ||
| 19 | 17 | process.kill(cat.pid, 'SIGKILL'); | |
| 20 | - }); | ||
| 18 | + })); | ||
| 21 | 19 | ||
| 22 | 20 | // EPIPE when null sig fails | |
| 23 | 21 | cat.stdin.write('test'); | |
| 24 | - | ||
| 25 | - process.on('exit', function() { | ||
| 26 | - assert.ok(called); | ||
| 27 | - }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments