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