DNA
DNA•2y ago

Kill Deno.Command

Is it possible to kill/end a Deno.command-instance? Example code:
(async () => {
let ffmpegProcess: Promise<Deno.CommandOutput> | undefined;
ffmpegProcess = new Deno.Command("ffmpeg", {args: ["-i", filename, `${folder}/frame%08d.png`, "-threads", "1"]}).output();
await ffmpegProcess;
done = true;
})();

// Later some time
ffmpegProcess.close(); // Something like that?
(async () => {
let ffmpegProcess: Promise<Deno.CommandOutput> | undefined;
ffmpegProcess = new Deno.Command("ffmpeg", {args: ["-i", filename, `${folder}/frame%08d.png`, "-threads", "1"]}).output();
await ffmpegProcess;
done = true;
})();

// Later some time
ffmpegProcess.close(); // Something like that?
7 Replies
crowlKats
crowlKats•2y ago
command.kill
DNA
DNAOP•2y ago
No description
DNA
DNAOP•2y ago
Not an option
crowlKats
crowlKats•2y ago
ah, you are using .output(). to do more manual things, you need to use .child().
DNA
DNAOP•2y ago
That works, thanks How can i wait for that command to finish though?
Mrcool 🇵🇸
const process = new Deno.Command("ls").spawn()
// kill -> process.kill()
// wait -> await process.status
const process = new Deno.Command("ls").spawn()
// kill -> process.kill()
// wait -> await process.status
DNA
DNAOP•2y ago
That works Thank you very much

Did you find this page helpful?