Reputation: 75
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:
Deno.run({ cmd: ["which", "code"] });
outputs /usr/local/bin/code
(same as terminal).Deno.run({ cmd: ["type", "code"] });
outputs nothing. The terminal outputs code is /usr/local/bin/code
!How do I start working out why some commands work (which
) and others don't (code
and type
)?
Upvotes: 2
Views: 929
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