herenickname
herenickname3mo ago

Several commands at once

const command = `
iptables -F
iptables -X
...and more more more...
`
const cmd = new Deno.Command(command)
const { stdout, stderr } = await cmd.output()
const command = `
iptables -F
iptables -X
...and more more more...
`
const cmd = new Deno.Command(command)
const { stdout, stderr } = await cmd.output()
command contains 15 large iptables commands that I want to execute on my local machine. When using the exec() function from the npm:ssh2 package, everything works, but Deno.command returns stderr File name too long (OS error 36) I tried calling /bin/sh and passing the command as an argument, but the error doesn't change. How can I avoid this?
1 Reply
herenickname
herenicknameOP3mo ago
new Deno.Command('sh', { args: ['-c', command] }) works