Skip to content

Commit

Permalink
perf: update zx to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Apr 6, 2024
1 parent 959ba03 commit e0f5267
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 14 deletions.
38 changes: 29 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
"dependencies": {
"@qiwi/deep-proxy": "^3.0.0",
"@types/ip": "^1.1.3",
"@types/node": "^20.11.30",
"@types/node": "^20.12.5",
"@types/semver": "^7.5.8",
"@webpod/ps": "^0.0.0-beta.3",
"globby-cp": "^1.3.0",
"ini": "^4.1.2",
"ip": "^2.0.1",
Expand All @@ -50,7 +51,7 @@
"semver": "^7.6.0",
"ssri": "^10.0.5",
"tempy": "^3.1.0",
"zx": "7.2.3-dev.0844b88"
"zx": "8.0.0"
},
"devDependencies": {
"c8": "^9.1.0"
Expand Down
27 changes: 24 additions & 3 deletions src/test/js/test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {strict as assert} from 'node:assert'
// import ps from '@webpod/ps'
import {
$,
semver,
Expand All @@ -12,7 +13,8 @@ import {
fs,
path,
SSRI,
INI
INI,
ps,
} from '../../main/js/index.mjs'

// $.verbose
Expand Down Expand Up @@ -109,14 +111,33 @@ password = dbpassword
{
const SIGNAL = 'SIGTERM'
const nothrow = createHook({nothrow: true}, 'nothrow')
const quiet = createHook({ verbose: 0 }, 'quiet')
const quiet = createHook({ verbose: 0, quiet: true }, 'quiet')
const debug = createHook({ verbose: 2 }, 'debug')
const timeout = createHook(
null,
'timeout',
(p, t, signal) => {
if (!t) return p
let timer = setTimeout(() => p.kill(signal), t)
let timer = setTimeout(() => {
(async () => {
console.log('p.pid=', p.child.pid);

try {
// p.kill(signal)
const list = await ps.tree({ pid: p.child.pid, recursive: true })
console.log('ps', list)
for (const l of list) {
process.kill(+l.pid)
}

process.kill(+p.child.pid, signal)

} catch (e) {
console.log('!!!!=',e)
}
})()
// p.kill(signal)
}, t)

p.finally(() => clearTimeout(timer))

Expand Down

0 comments on commit e0f5267

Please sign in to comment.