Skip to main content

execute

Function execute 

Source
pub fn execute(command: option<string>) -> (boolean, string, number)
Expand description

Runs a shell command.

§Parameters

  • command: the command passed to the operating system shell. When absent, the function instead reports whether a shell is available.

§Return value

A boolean that is true when the command terminated successfully, followed by the string "exit" (the command ended normally) or "signal" (it was terminated by a signal) and the return status. When called without a command, returns only a boolean indicating whether a shell is available.

§Examples

print(os.execute("exit 0"))    --> true   exit   0
print(os.execute("exit 3"))    --> nil    exit   3
print(os.execute())            --> true   (a shell exists)

§See also

io::popen