Skip to content

Instantly share code, notes, and snippets.

@tukkek
Last active November 5, 2025 13:08
Show Gist options
  • Select an option

  • Save tukkek/a0f5004f85767bbff3be9608abd7e967 to your computer and use it in GitHub Desktop.

Select an option

Save tukkek/a0f5004f85767bbff3be9608abd7e967 to your computer and use it in GitHub Desktop.
Runs a Deno system command.
/**
* Runs a system command.
*
* @param {string[]} flags An array of arguments, first one being the command name or path.
* @returns {number} The command's exit-status.
* @see https://docs.python.org/3/library/os.html#os.system
*/
async function run(flags){
let command=new Deno.Command(flags[0],{'args':flags.slice(1)})
let result=await command.output()
for(let code of [result.stdout,result.stderr])
console.log(new TextDecoder().decode(code))
return result.code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment