-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b267d07
commit fd5fcfd
Showing
6 changed files
with
115 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { kill, lookup } from './ps.ts' | ||
import { kill, lookup, tree } from './ps.ts' | ||
|
||
export type * from './ps.ts' | ||
export { kill, lookup } from './ps.ts' | ||
export default { lookup, kill } | ||
export { kill, lookup, tree } from './ps.ts' | ||
export default { lookup, kill, tree } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
var cp = require('node:child_process') | ||
var process = require('node:process') | ||
var now = Date.now(); | ||
console.log('[child] child process start!'); | ||
var argv = process.argv.slice(2); | ||
var marker = argv[0] | ||
var fork = +argv.find(v => v.startsWith('--fork='))?.slice(7) || 0; | ||
var depth = +argv.find(v => v.startsWith('--depth='))?.slice(8) || 0; | ||
|
||
function doSomething() { | ||
return null; | ||
while(depth) { | ||
depth-- | ||
const _fork = fork | ||
while (fork) { | ||
fork-- | ||
cp.fork(__filename, [marker, `--depth=${depth}`, `--fork=${_fork}`]) | ||
} | ||
} | ||
|
||
console.log('[child] child process start!', 'argv=', argv); | ||
|
||
setInterval(function () { | ||
doSomething(); | ||
}, 50); | ||
|
||
function doSomething() { | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import * as assert from 'node:assert' | ||
import { describe, it } from 'node:test' | ||
import ps, { kill, lookup } from '../../main/ts/index.ts' | ||
import ps, { kill, lookup, tree } from '../../main/ts/index.ts' | ||
|
||
describe('index', () => { | ||
it('has proper exports', () => { | ||
assert.equal(ps.lookup, lookup) | ||
assert.equal(ps.kill, kill) | ||
assert.equal(ps.tree, tree) | ||
assert.equal(typeof lookup, 'function') | ||
assert.equal(typeof kill, 'function') | ||
assert.equal(typeof tree, 'function') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters