process.kill
process.kill
Function
Terminate the started child process. Under Windows, it will try to recursively terminate the child process tree of the process first, and then terminate the process itself.
Syntax
process(program).child().kill()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Bool | Returns true if the termination signal is successfully sent; returns false if there is no child process handle or the process has exited. |
Example
cmd = process('cmd') result = cmd.kill() // Output: false print result
Notes
- kill will not clear the currently saved child process handle.
- Kill under Windows will recursively terminate the child process tree through the system process snapshot, which is suitable for canceling multi-level conversion tasks such as PowerShell, WPS, and poppler.
- Under Linux/macOS, kill still terminates the direct child process; if the business requires cancellation at the process group level, it should be managed by the started external program itself.