tcprocd runner.

class tcprocd.runner.Runner(name, command, owner, on_exit, path=None, as_user=None, as_group=None)[source]

Bases: threading.Thread

A class to run a process in a thread.

  • name – name of the process to access it
  • command – command to run the process
  • owner – the user who starts this process
  • on_exit – a function that will be called when the process exits
  • path – Path to execeute the command in
  • user – System user to switch to before starting the process
  • group – System group to switch to before starting the process
daemon = True

Make the thread a daemon


Send the given line to all attached handlers.


Cleanup and close handlers.


Write message to process’s stdin.


Switch user and group.


Start the runner.

Execute command and call on_line for each line of output until it terminates. Change the directory to path and switch user and group (if they’re given) before running the process. Finally call on_exit.


Kill the process if it exists.