uv.signal_start(signal, "sigint", function(signame)
print("got " .. signame .. ", shutting down")
os.exit(1)
end)
<
uv.new_signal() *uv.new_signal()*
Creates and initializes a new |uv_signal_t|. Returns the Lua
userdata wrapping it.
Returns: `uv_signal_t userdata` or `fail`
uv.signal_start({signal}, {signame}, {callback}) *uv.signal_start()*
> method form `signal:start(signame, callback)`
Parameters:
- `signal`: `uv_signal_t userdata`
- `signame`: `string` or `integer`
- `callback`: `callable`
- `signame`: `string`
Start the handle with the given callback, watching for the
given signal.
See |luv-constants| for supported `signame` input and output
values.
Returns: `0` or `fail`
*uv.signal_start_oneshot()*
uv.signal_start_oneshot({signal}, {signame}, {callback})
> method form `signal:start_oneshot(signame, callback)`
Parameters:
- `signal`: `uv_signal_t userdata`
- `signame`: `string` or `integer`
- `callback`: `callable`
- `signame`: `string`
Same functionality as |uv.signal_start()| but the signal
handler is reset the moment the signal is received.
See |luv-constants| for supported `signame` input and output
values.
Returns: `0` or `fail`
uv.signal_stop({signal}) *uv.signal_stop()*
> method form `signal:stop()`
Parameters:
- `signal`: `uv_signal_t userdata`
Stop the handle, the callback will no longer be called.
Returns: `0` or `fail`
==============================================================================
`uv_process_t` — Process handle *luv-process-handle* *uv_process_t*
> |uv_handle_t| functions also apply.
Process handles will spawn a new process and allow the user to control it and
establish communication channels with it using streams.
uv.disable_stdio_inheritance() *uv.disable_stdio_inheritance()*
Disables inheritance for file descriptors / handles that this
process inherited from its parent. The effect is that child
processes spawned by this process don't accidentally inherit
these handles.
It is recommended to call this function as early in your
program as possible, before the inherited file descriptors can
be closed or duplicated.
Returns: Nothing.
Note: This function works on a best-effort basis: there is no
guarantee that libuv can discover all file descriptors that
were inherited. In general it does a better job on Windows
than it does on Unix.
uv.spawn({path}, {options}, {on_exit}) *uv.spawn()*
Parameters:
- `path`: `string`
- `options`: `table` (see below)
- `on_exit`: `callable`
- `code`: `integer`
- `signal`: `integer`
Initializes the process handle and starts the process. If the
process is successfully spawned, this function will return the
handle and pid of the child process.
Possible reasons for failing to spawn would include (but not
be limited to) the file to execute not existing, not having
permissions to use the setuid or setgid specified, or not
having enough memory to allocate