DNA
DNA•5mo 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•5mo ago
command.kill
DNA
DNA•5mo ago
No description
DNA
DNA•5mo ago
Not an option
crowlKats
crowlKats•5mo ago
ah, you are using .output(). to do more manual things, you need to use .child().
DNA
DNA•5mo 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
DNA•5mo ago
That works Thank you very much