hammerspoon2-docs
    Preparing search index...

    Class HSTask

    Object representing an external process task

    Index

    Constructors

    Properties

    environment: Record<string, string>

    The environment variables for the task

    Can only be modified before calling start()

    isRunning: boolean

    Check if the task is currently running

    true if the task is running, false otherwise

    pid: number

    The process ID of the running task

    The value will be -1 if the task is not running

    terminationReason: string | null

    The termination reason

    Returns a string describing why the task terminated, or nil if still running

    terminationStatus: number | null

    The termination status of the task

    Returns the exit code, or nil if the task hasn't terminated

    workingDirectory: string | null

    The working directory for the task

    Can only be modified before calling start()

    Methods

    • Close the task's stdin

      Returns void

    • Interrupt the task (send SIGINT)

      Returns void

    • Terminate the task with extreme prejudice (send SIGKILL)

      Returns void

    • Pause the task (send SIGSTOP)

      Returns void

    • Resume the task (send SIGCONT)

      Returns void

    • Write data to the task's stdin

      Parameters

      • data: string

        The string data to write

      Returns void

    • Start the task

      Returns HSTask

      The task object for chaining

    • Terminate the task (send SIGTERM)

      Returns void

    • Wait for the task to complete (blocking)

      Returns void