exec function:

  • Can also be called as execute

Execute an external proccess and wait for it's completion. If all the arguments are strings run a process with that list. The result is an object with:

  • success Boolean to indicate if the process was successfull.
  • exit_code The process exit code.
  • raw_stdout The standart output of the process encode as BASE64.
  • stdout The standart output as text.
  • raw_stderr The standart error of the process encode as BASE64.
  • stderr The standart 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