Flowdock
exec(*args) public

Replaces the current process by running the given external command. If optional arguments, sequence of arg, are not given, that argument is taken as a line that is subject to shell expansion before being executed. If one or more arg given, they are passed as parameters to command with no shell expansion. If command is a two-element array, the first element is the command to be executed, and the second argument is used as the argv[0] value, which may show up in process listings. In order to execute the command, one of the exec(2) system calls is used, so the running command may inherit some of the environment of the original program (including open file descriptors).

The hash arguments, env and options, are same as system and spawn. See spawn for details.

Raises SystemCallError if the command couldn’t execute (typically Errno::ENOENT when it was not found).

exec "echo *"       # echoes list of files in current directory
# never get here

exec "echo", "*"    # echoes an asterisk
# never get here
Show source
Register or log in to add new notes.