API Docs

Object representing an external process task

Properties

isRunning

boolean
Check if the task is currently running

pid

Int32
The process ID of the running task

environment

{[key: string]: string}
The environment variables for the task

workingDirectory

string
The working directory for the task

terminationStatus

NSNumber
The termination status of the task

Methods

start() -> HSTask

Start the task
start() -> HSTask
HSTask
The task object for chaining
const t = hs.task.new("/bin/echo", ["hi"])
t.start()

terminate() -> None

Terminate the task (send SIGTERM)
terminate() -> None
None
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.terminate()

kill9() -> None

Terminate the task with extreme prejudice (send SIGKILL)
kill9() -> None
None
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.kill9()

interrupt() -> None

Interrupt the task (send SIGINT)
interrupt() -> None
None
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.interrupt()

pause() -> None

Pause the task (send SIGSTOP)
pause() -> None
None
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.pause()

resume() -> None

Resume the task (send SIGCONT)
resume() -> None
None
const t = hs.task.new("/bin/sleep", ["60"]).start()
t.pause(); t.resume()

waitUntilExit() -> None

Wait for the task to complete (blocking)
waitUntilExit() -> None
None
const t = hs.task.new("/bin/echo", ["hi"]).start()
t.waitUntilExit()

sendInput(data) -> None

Write data to the task's stdin
sendInput(data) -> None
Name Type Description
data string The string data to write
None
const t = hs.task.new("/usr/bin/cat", []).start()
t.sendInput("hello\n")

closeInput() -> None

Close the task's stdin
closeInput() -> None
None
const t = hs.task.new("/usr/bin/cat", []).start()
t.sendInput("hello\n")
t.closeInput()