George Andersen
George Andersen

Reputation: 75

Why does Deno.run not work for some commands?

When I run code . in my MacOS terminal it opens VSCode in the current folder.

However nothing happens when I run deno run --allow-run file.ts where file.ts is the following:

Deno.run({ cmd: ["code", "."] });

I've looked at the Deno.run documentation and cannot find anything as to why this doesn't work.

Tests I've run:

How do I start working out why some commands work (which) and others don't (code and type)?

Upvotes: 2

Views: 929

Answers (1)

mfulton26
mfulton26

Reputation: 31234

Your process is ending before the new subprocess command completes causing the subprocess to be interrupted/killed before completion.

You can await the output() or status() to avoid this:

await Deno.run({ cmd: ["code", "."] }).status();

Upvotes: 6

Related Questions