In python, the following line results in an interactive shell which I can use like any terminal.
os.system("bash");
Typing exit here quits the shell and the python script continues to execute.
How can i do something like this in Deno?
Edit: I should have been a bit more verbose in my initial question. My intent is not just to run a shell command. I want to run an interactive shell which grabs input/output until I manually exit with exit command. Deno.run({cmd: ["bash"]}) does not do this.
You need to wait for the process (the bash shell) to exit. To do this, you to need await process.status().
// run using
// deno run --allow-run demo.js
const p = Deno.run({
cmd: ["bash"],
})
const status = await p.status()
console.log(status)
If you want to do it the Deno REPL, then run-
await Deno.run({ cmd: ["bash"] }).status()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With