# Stem Docs

## System Utilities

Helper functions for working with the underlying system. These are mostly os dependent, only working on linux, osx, and bsd. In almost all cases they’re best-effort, providing None if the lookup fails.

Changed in version 1.3.0: Dropped the get_* prefix from several function names. The old names still work, but are deprecated aliases.

Changed in version 1.5.0: Added the SYSTEM_CALL_TIME global, which tracks total time spent making system commands.

Module Overview:

    is_windows - checks if we're running on windows
    is_mac - checks if we're running on a mac
    is_gentoo - checks if we're running on gentoo
    is_slackware - checks if we're running on slackware
    is_bsd - checks if we're running on the bsd family of operating systems

    is_available - determines if a command is available on this system
    is_running - determines if a given process is running
    size_of - provides the memory usage of an object
    call - runs the given system command and provides back the results

    name_by_pid - gets the name for a process by the given pid
    pid_by_name - gets the pid for a process by the given name
    pid_by_port - gets the pid for a process listening to a given port
    pid_by_open_file - gets the pid for the process with an open file
    pids_by_user - provides processes owned by a user
    cwd - provides the current working directory for a given process
    user - provides the user a process is running under
    start_time - provides the unix timestamp when the process started
    tail - provides lines from the end of a file
    bsd_jail_id - provides the BSD jail id a given process is running within
    bsd_jail_path - provides the path of the given BSD jail

    is_tarfile - checks if the given path is a tarball
    expand_path - expands relative paths and ~ entries
    files_with_suffix - provides files with the given suffix

    get_process_name - provides our process' name
    set_process_name - changes our process' name

stem.util.system.Status(enum)

  State of a subprocess.

  Added in version 1.6.0.

  Status | Description
  --- | ---
  PENDING | not yet started
  RUNNING | currently being performed
  DONE | completed successfully
  FAILED | failed with an exception