Usage of Deno.Command?
Hey guys we use Deno.run to launch shell cmd and pipe the result to log.
But Deno.run will be deprecated and I am not able to write a good equivalent with Deno.Command, do you have a suggestion?
Here is my simple Deno.run:
5 Replies
if I use the example of Deno.Command, something like
It works but I have the log after total execution, I would like the log as execution progresses
Sure, I can help you with that. The
Deno.Command
class is used to create a child process. It has methods like output()
, outputSync()
, and spawn()
to execute the command and collect its output. Here's how you can rewrite your function using Deno.Command
:
Please note that the Deno.Command
API is still unstable, so you need to run your script with the --unstable
flag. Also, the Deno.Command
class does not have a cwd
option, so you might need to adjust your command and arguments to account for the working directory.No u can't use command.output with stdin to piped
@RoXuS You would use command.spawn()
yes finally I have try :
And it is ok, I don't understand why the result are piped to the log but it works haha
thx for your response!