Last active
November 5, 2025 13:08
-
-
Save tukkek/a0f5004f85767bbff3be9608abd7e967 to your computer and use it in GitHub Desktop.
Runs a Deno system command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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