process.suspend
process.suspend
Function
Pause the started child process and its child process tree under Windows. Suitable for bt_app desktop batch processing tasks to temporarily suspend multi-level sub-processes such as PowerShell, WPS, and poppler.
Syntax
process(program).child().suspend()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Bool | Returns true if at least one thread is successfully suspended; returns false if there is no child process handle, the process has exited, or there are no threads to suspend. |
Example
cmd = process('cmd').args(['/C', 'ping 127.0.0.1 -n 5']).child() result = cmd.suspend() // Output: true print result cmd.resume() cmd.kill()
Notes
- suspend will not clear the currently saved child process handle.
- Under Windows, suspend will suspend accessible threads in the child process tree through system process and thread snapshots.
- After pausing, you usually need to call resume to resume, or call kill to cancel the task.
- Linux/macOS does not currently support this method and will return a runtime error.