Skip to content

how to run commands through the user shell with deno? #12487

@joaomelo

Description

@joaomelo

I'm trying to build a simple CLI tool to run dev scripts with Deno. The goal is to create cross-platform scripts with type safety.

I'm not succeeding with Deno.run(). I think this is due to part of my scripts are based on global packages installed with NPM like, for example, the firebase CLI tool.

If i run something like this:

  const { code } = await Deno.run({
    cmd: ["firebase", "emulators:start"],
  }).status();

I get this error

error: Uncaught (in promise) NotFound: O sistema não pode encontrar o arquivo especificado. (os error 2)
  const { code } = await Deno.run({

I found some clarification in this issue about echo. But, I'm afraid if I prefix everything with "cmd", "/c", the program will tie itself to the OS. Is this a valid assumption?

Is there another API that enables us to run commands through the current shell instead of attempt to find binaries in the system directly?

I think in node this is done with something like this:

    const p = spawn("firebase emulators:start", {
      shell: true,
    });

Thanks for the awesome tool.
JM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions