HSTask
TypeObject representing an external process task
Properties
Methods
start() -> HSTask
Start the task
Declaration
start() -> HSTask
Returns
HSTask
The task object for chaining
Example
const t = hs.task.new("/bin/echo", ["hi"])
t.start()
terminate() -> None
Terminate the task (send SIGTERM)
Declaration
terminate() -> None
Returns
None
Example
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.terminate()
kill9() -> None
Terminate the task with extreme prejudice (send SIGKILL)
Declaration
kill9() -> None
Returns
None
Example
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.kill9()
interrupt() -> None
Interrupt the task (send SIGINT)
Declaration
interrupt() -> None
Returns
None
Example
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.interrupt()
pause() -> None
Pause the task (send SIGSTOP)
Declaration
pause() -> None
Returns
None
Example
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.pause()
resume() -> None
Resume the task (send SIGCONT)
Declaration
resume() -> None
Returns
None
Example
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.pause(); t.resume()
waitUntilExit() -> None
Wait for the task to complete (blocking)
Declaration
waitUntilExit() -> None
Returns
None
Example
const t = hs.task.new("/bin/echo", ["hi"]).start()
t.waitUntilExit()
sendInput(data) -> None
Write data to the task's stdin
Declaration
sendInput(data) -> None
Parameters
| Name | Type | Description |
|---|---|---|
| data | string | The string data to write |
Returns
None
Example
const t = hs.task.new("/usr/bin/cat", []).start()
t.sendInput("hello\n")
closeInput() -> None
Close the task's stdin
Declaration
closeInput() -> None
Returns
None
Example
const t = hs.task.new("/usr/bin/cat", []).start()
t.sendInput("hello\n")
t.closeInput()