Permalink
Browse files

process, feat: add test case of kill.

  • Loading branch information...
xicilion committed Nov 2, 2017
1 parent f551793 commit 6a2b51e03c64f32a1a8a149dd7f276a290bd2f44
Showing with 15 additions and 2 deletions.
  1. +5 −1 test/process/exec.js
  2. +10 −1 test/process_test.js
View
@@ -1,7 +1,11 @@
console.log('exec testing....');
var coroutine = require('coroutine');
var process = require('process');
process.on("SIGTERM", () => {
console.log("killed");
process.exit(0);
});
for (var i = 0; i < 2; i++) {
coroutine.sleep(1000);
View
@@ -10,7 +10,7 @@ var cmd;
var s;
describe('process', () => {
it("execPath", () => {
before(() => {
cmd = process.execPath;
});
@@ -113,6 +113,15 @@ describe('process', () => {
assert.lessThan(new Date().getTime() - t1, 100);
});
it("kill", () => {
var t1 = new Date().getTime();
var p = process.start(cmd, [path.join(__dirname, 'process', 'exec.js')]);
coroutine.sleep(500);
p.kill(15);
p.wait();
assert.lessThan(new Date().getTime() - t1, 1000);
});
it("memoryUsage", () => {
console.dir(process.memoryUsage());
});

0 comments on commit 6a2b51e

Please sign in to comment.