exec function:
- Can also be called as
execute
Execute an external process and wait for it's completion. If all the arguments are strings run a process with that list. The result is an object with:
successBoolean to indicate if the process was successful.exit_codeThe process exit code.raw_stdoutThe standard output of the process encode as BASE64.stdoutThe standard output as text.raw_stderrThe standard error of the process encode as BASE64.stderrThe standard error as text.
Examples:
- running:
(exec "echo", "hello", "world")will give:{"success": true, "exit_code": 0, "raw_stdout": "aGVsbG8gd29ybGQK", "stdout": "hello world\n", "raw_stderr": "", "stderr": ""}
- running:
(exec "cat", "no such file")will give:{"success": false, "exit_code": 1, "raw_stdout": "", "stdout": "", "raw_stderr": "Y2F0OiAnbm8gc3VjaCBmaWxlJzogTm8gc3VjaCBmaWxlIG9yIGRpcmVjdG9yeQo=", "stderr": "cat: 'no such file': No such file or directory\n"}
- running:
(exec "no such exec")will return nothing
- running:
(exec 23)will return nothing Because 23 is not a string
- running:
(exec "echo", 23)will return nothing Because 23 is not a string