Module: SystemCommand::Mixin

Overview

This module is part of an internal API. This module may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Helper functions for calling run.

Instance Method Summary collapse

Instance Method Details

#system_command(executable, args: [], sudo: false, sudo_as_root: false, env: {}, input: [], must_succeed: false, print_stdout: false, print_stderr: true, debug: nil, verbose: nil, secrets: [], chdir: T.unsafe(nil), reset_uid: false, timeout: nil) ⇒ SystemCommand::Result

This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Run a fallible system command.

Parameters:

  • executable (String, Pathname)
  • args (Array<String, Integer, Float, Pathname, URI::Generic>) (defaults to: [])
  • sudo (Boolean) (defaults to: false)
  • sudo_as_root (Boolean) (defaults to: false)
  • env (Hash{String => nil, String, Boolean}) (defaults to: {})
  • input (String, Array<String>) (defaults to: [])
  • must_succeed (Boolean) (defaults to: false)
  • print_stdout (Boolean, Symbol) (defaults to: false)
  • print_stderr (Boolean, Symbol) (defaults to: true)
  • debug (Boolean, nil) (defaults to: nil)
  • verbose (Boolean, nil) (defaults to: nil)
  • secrets (String, Array<String>) (defaults to: [])
  • chdir (String, Pathname) (defaults to: T.unsafe(nil))
  • reset_uid (Boolean) (defaults to: false)
  • timeout (Integer, Float, nil) (defaults to: nil)

Returns:



43
44
45
46
47
48
# File 'system_command.rb', line 43

def system_command(executable, args: [], sudo: false, sudo_as_root: false, env: {}, input: [],
                   must_succeed: false, print_stdout: false, print_stderr: true, debug: nil, verbose: nil,
                   secrets: [], chdir: T.unsafe(nil), reset_uid: false, timeout: nil)
  SystemCommand.run(executable, args:, sudo:, sudo_as_root:, env:, input:, must_succeed:, print_stdout:,
                    print_stderr:, debug:, verbose:, secrets:, chdir:, reset_uid:, timeout:)
end

#system_command!(executable, args: [], sudo: false, sudo_as_root: false, env: {}, input: [], print_stdout: false, print_stderr: true, debug: nil, verbose: nil, secrets: [], chdir: T.unsafe(nil), reset_uid: false, timeout: nil) ⇒ SystemCommand::Result

This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Run an infallible system command.

Parameters:

  • executable (String, Pathname)
  • args (Array<String, Integer, Float, Pathname, URI::Generic>) (defaults to: [])
  • sudo (Boolean) (defaults to: false)
  • sudo_as_root (Boolean) (defaults to: false)
  • env (Hash{String => nil, String, Boolean}) (defaults to: {})
  • input (String, Array<String>) (defaults to: [])
  • print_stdout (Boolean, Symbol) (defaults to: false)
  • print_stderr (Boolean, Symbol) (defaults to: true)
  • debug (Boolean, nil) (defaults to: nil)
  • verbose (Boolean, nil) (defaults to: nil)
  • secrets (String, Array<String>) (defaults to: [])
  • chdir (String, Pathname) (defaults to: T.unsafe(nil))
  • reset_uid (Boolean) (defaults to: false)
  • timeout (Integer, Float, nil) (defaults to: nil)

Returns:



71
72
73
74
75
76
# File 'system_command.rb', line 71

def system_command!(executable, args: [], sudo: false, sudo_as_root: false, env: {}, input: [],
                    print_stdout: false, print_stderr: true, debug: nil, verbose: nil, secrets: [],
                    chdir: T.unsafe(nil), reset_uid: false, timeout: nil)
  SystemCommand.run!(executable, args:, sudo:, sudo_as_root:, env:, input:, print_stdout:,
                     print_stderr:, debug:, verbose:, secrets:, chdir:, reset_uid:, timeout:)
end