• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Bot 4.x
    2. Version 4.x
    3. Version 3.0
    4. Version 2.0
    5. Version 1.0
    6. Module and Class Reference
    7. reviewbot.utils.process
  • Home
  • Installation
  • Manually Installing Review Bot
  • Review Bot Docker Images
  • Upgrading Review Bot
  • Configuring Review Bot
  • Review Bot Tools
  • Cargo Tool
  • Checkstyle
  • Clang Static Analyzer
  • Cppcheck
  • Cpplint
  • Doc8
  • FBInfer
  • Flake8
  • Go Fmt
  • Go Tool
  • JSHint
  • PMD
  • Pycodestyle
  • Pydocstyle
  • Pyflakes
  • RuboCop
  • Rust Fmt
  • Secret Scanner
  • ShellCheck
  • Module and Class Reference
  • reviewbot.tools.base
  • reviewbot.tools.base.mixins
  • reviewbot.tools.base.registry
  • reviewbot.tools.base.tool
  • reviewbot.testing.testcases
  • reviewbot.testing.utils
  • reviewbot.tools.testing
  • reviewbot.tools.testing.decorators
  • reviewbot.tools.testing.testcases
  • reviewbot.processing.review
  • reviewbot.utils.api
  • reviewbot.utils.filesystem
  • reviewbot.utils.log
  • reviewbot.utils.process
  • reviewbot.utils.text
  • reviewbot.celery
  • reviewbot.config
  • reviewbot.deprecation
  • reviewbot.errors
  • reviewbot.repositories
  • reviewbot.tasks
  • reviewbot.tools.cargotool
  • reviewbot.tools.checkstyle
  • reviewbot.tools.clang
  • reviewbot.tools.cppcheck
  • reviewbot.tools.cpplint
  • reviewbot.tools.doc8
  • reviewbot.tools.fbinfer
  • reviewbot.tools.flake8
  • reviewbot.tools.gofmt
  • reviewbot.tools.gotool
  • reviewbot.tools.jshint
  • reviewbot.tools.pmd
  • reviewbot.tools.pycodestyle
  • reviewbot.tools.pydocstyle
  • reviewbot.tools.pyflakes
  • reviewbot.tools.rbsecretscanner
  • reviewbot.tools.rubocop
  • reviewbot.tools.rustfmt
  • reviewbot.tools.shellcheck
  • General Index
  • Python Module Index
  • Release Notes
  • reviewbot.utils.process¶

    Utility functions for Process invocation and management.

    Functions

    execute(command[, env, split_lines, ...])

    Execute a command and return the output.

    is_exe_in_path(name[, cache])

    Check whether an executable is in the user's search path.

    execute(command, env=None, split_lines=False, ignore_errors=False, extra_ignore_errors=(), translate_newlines=True, with_errors=True, return_errors=False, none_on_ignored_error=False)[source]¶

    Execute a command and return the output.

    Parameters:
    • command (list of str) – The command to run.

    • env (dict, optional) – The environment variables to use when running the process.

    • split_lines (bool, optional) – Whether to return the output as a list (split on newlines) or a single string.

    • ignore_errors (bool, optional) – Whether to ignore non-zero return codes from the command.

    • extra_ignore_errors (tuple of int, optional) – Process return codes to ignore.

    • translate_newlines (bool, optional) – Whether to convert platform-specific newlines (such as rn) to the regular newline (n) character.

    • with_errors (bool, optional) – Whether the stderr output should be merged in with the stdout output or just ignored.

    • return_errors (bool, optional) – Whether to return the content of the stderr stream. If set, this argument takes precedence over the with_errors argument.

    • none_on_ignored_error (bool, optional) – Whether to return None if there was an ignored error (instead of the process output).

    Returns:

    This returns a single value or 2-tuple, depending on the arguments.

    If return_errors is True, this will return the standard output and standard errors as strings in a tuple. Otherwise, this will just result the standard output as a string.

    If split_lines is True, those strings will instead be lists of lines (preserving newlines).

    All resulting strings will be Unicode.

    Return type:

    object

    is_exe_in_path(name, cache={})[source]¶

    Check whether an executable is in the user’s search path.

    If the provided filename is an absolute path, it will be checked directly without looking in the search path.

    Changed in version 3.0: Added the cache parameter.

    Parameters:
    • name (str) – The name of the executable, without any platform-specific executable extension. The extension will be appended if necessary.

    • cache (dict, optional) –

      A result cache, to avoid repeated lookups.

      This will store the paths to any files that are found (or None if not found).

      By default, the cache is shared across all calls. A custom cache can be provided instead.

    Returns:

    True if the executable can be found in the execution path.

    Return type:

    boolean

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • execute()
    • is_exe_in_path()