Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
maybe fix star
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi committed Mar 27, 2023
1 parent 8c94189 commit 3b94bcf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cli/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ import { download } from "../deps/capi_binary_builds.ts"
export default async function(binary: string, version: string, ...args: string[]) {
if (!binary || !version) throw new Error("Must specify binary and version")

const abortController = new AbortController()
for (const signal of ["SIGTERM", "SIGINT"] satisfies Deno.Signal[]) {
Deno.addSignalListener(signal, () => {
console.log(signal)
abortController.abort()
})
}
const { signal } = abortController

const binaryPath = await download(binary, version)

const child = new Deno.Command(binaryPath, {
args,
stdin: "inherit",
stdout: "inherit",
stderr: "inherit",
signal,
}).spawn()

for (const signal of ["SIGTERM", "SIGINT"] satisfies Deno.Signal[]) {
Deno.addSignalListener(signal, () => {
console.log(signal)
child.kill(signal)
})
}

Deno.exit((await child.status).code)
}

0 comments on commit 3b94bcf

Please sign in to comment.