Reputation: 129
import { exec } from "https://deno.land/x/exec/mod.ts";
await exec(`git clone https://github.com/vuejs/vue.git`)
when i use git clone https://github.com/vuejs/vue.git
in .sh file, It has message in terminal,
but don't have in deno
Upvotes: 0
Views: 342
Reputation: 31234
First, I think it is important to echo what jsejcksn commented:
The
exec
module is not related to Deno. All modules athttps://deno.land/x/...
are third-party code. For working with your shell, see Creating a subprocess in the manual.
Deno's way of doing this without a 3rd party library is to use Deno.run
.
With that said, if you take a look at exec
's README you'll find documentation for what you're looking for under Capture the output of an external command:
Sometimes you need to capture the output of a command. For example, I do this to get git log checksums:
import { exec } from "https://deno.land/x/exec/mod.ts"; let response = await exec('git log -1 --format=%H', {output: OutputMode.Capture});
If you look at exec
's code you'll find it uses Deno.run
under the hoods. If you like exec
you can use it but you might find you like using Deno.run
directly instead.
Upvotes: 1