DNA
DNA4mo 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
crowlKats4mo ago
command.kill
DNA
DNA4mo ago
No description
DNA
DNA4mo ago
Not an option
crowlKats
crowlKats4mo ago
ah, you are using .output(). to do more manual things, you need to use .child().
DNA
DNA4mo ago
That works, thanks How can i wait for that command to finish though?
Mrcool 🇵🇸
Mrcool 🇵🇸4mo ago
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
DNA4mo ago
That works Thank you very much