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