DenoDDeno
Powered by
tarkovT
Deno•3y ago•
37 replies
tarkov

Can't spawn a shell properly using Deno!

const bash = (() => {
  const bashProc = spawn("bash");

  bashProc.stdout.on("data", (data: string) => {
    console.log(`stdout: ${data}`);
  });

  bashProc.stderr.on("data", (err: string) => {
    console.error(`stderr: ${err}`);
    throw Error(err);
  });

  bashProc.on("close", (code: string) => {
    console.log(`child process exited with code ${code}`);
  });

  return bashProc.stdin.write;
})();
bash('echo lll');
const bash = (() => {
  const bashProc = spawn("bash");

  bashProc.stdout.on("data", (data: string) => {
    console.log(`stdout: ${data}`);
  });

  bashProc.stderr.on("data", (err: string) => {
    console.error(`stderr: ${err}`);
    throw Error(err);
  });

  bashProc.on("close", (code: string) => {
    console.log(`child process exited with code ${code}`);
  });

  return bashProc.stdin.write;
})();
bash('echo lll');


I know there is
Deno.run
Deno.run
, but I need a way to be able to access the std outputs and errors.
I'm really new to Deno, sorry if this is a dumb question.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Deno + Vite + DenoKV
AndiAAndi / help
2y ago
`.svelte` file intellisense can't properly resolve imports in a Deno only project
FlowFFlow / help
14mo ago
deno fmt doesn't work properly using Visual Studio Code and WSL2
againAagain / help
2y ago