rb.system reads the state of the computer a script runs on: the clock, the
cursor position, the screen size and the focused window. It also runs commands and
types text through the operating system. A script reaches for it to check which
app has focus, call a command-line tool, or enter text.
Needs: the exec permission for
exec and exec_detached.
This script runs git status on F5 and logs its error output when the command
exits with a nonzero code:
rb.system.exec
Runscmd through the shell (cmd.exe /C on Windows, sh -c on macOS) and
waits for it.
options.timeout: milliseconds, default 5000. On expiry the process is killed (on macOS its whole process group) and the call raisesexec timed out after <ms>ms.options.cwd: working directory.stdoutandstderrkeep the first 64 KB (65,536 bytes) each, with trailing whitespace trimmed.exitis-1when the process has no exit code.- On Windows no console window appears.
exec permission the call raises
System.Exec() requires 'exec' permission and Rebind stops the script.
rb.system.exec_detached
Startscmd directly, without a shell, and returns its process id at once.
options.args is a list of arguments, passed as given; options.cwd sets the
working directory. Output is discarded and the process keeps running after the
script stops. A failed start raises exec detached spawn failed: <reason>.
rb.system.type_text
Typestext through the host operating system and never through the script’s
HID output, so it types the same in hardware mode. That includes any Unicode.
It raises when the operating system refuses the input, for example macOS
without the Accessibility grant.