Notes
- A detached process will still run even if the current program terminates.
- A detached process can not have stdin/stdout/stderr redirection
sysutils.Process(cmd, [hidden], [redirect]) constructor
The Process constructor creates a new Windows process.
Parameters
cmd
A string
representing the command to be executed as a new process, that contains the executable and parameters separated by spaces
[hidden]
An optional boolean
value indicating if the application is hidden, defaulting to false
[redirect]
An optional boolean
value indicating if the process stdin, stdout and stderr are redirected, defaulting to false
[detached]
An optional boolean
value indicating if the process is detached (ie a standalone process not attached to the current process), defaulting to false
Example
local sysutils = require "sysutils"
local ui = require "ui"
-- create a process launching Notepad
local p = sysutils.Process("notepad.exe")
-- start the process and wait for it to terminate
p:spawn():wait()
ui.info("Notepad application has been closed")