Shadow
Shadow9mo ago

Subprocess

can someone help me how do i get to show Hello world in my terminal by using Deno.Commands () using echo
8 Replies
Fifth-Normal-Form always
For Windows. You need to execute. echo from a command processor -- "cmd"
const command = new Deno.Command("cmd", {
args: ["/c", "echo","hello world"],
stdin: "piped",
stdout: "piped"
}).spawn();

let result = await command.output();
const textDecoder = new TextDecoder();
console.log(textDecoder.decode(result.stdout));
const command = new Deno.Command("cmd", {
args: ["/c", "echo","hello world"],
stdin: "piped",
stdout: "piped"
}).spawn();

let result = await command.output();
const textDecoder = new TextDecoder();
console.log(textDecoder.decode(result.stdout));
Shadow
ShadowOP9mo ago
@Altair 680b i am quite new to this . could you help me with one last doubt i have i want to npm init (for example ) in the current working directory
Fifth-Normal-Form always
FYI many linux commands are just executables. In Windows, they are methods of the command processor. I was unable to spawn 'npm' Not sure why. Try asking the #Deno AI Helper
Shadow
ShadowOP9mo ago
i tried using , ls , pwd in
args: ["/c", "ls"],
args: ["/c", "ls"],
'ls' is not recognized as an internal or external command, operable program or batch file. @Deno AI Helper
Fifth-Normal-Form always
Also, you may want to try DAX -- written by a Deno core team member. https://github.com/dsherret/dax
Shadow
ShadowOP9mo ago
Thanks alot mate
Fifth-Normal-Form always
@Deno AI Helper any help with this?
Shadow
ShadowOP9mo ago
ill experiment with it and if i hit a block i believe you are here for me then