Class: JetBlack::NonInteractiveCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/jet_black/non_interactive_command.rb

Instance Method Summary collapse

Instance Method Details

#call(raw_command:, stdin:, raw_env:, directory:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/jet_black/non_interactive_command.rb', line 6

def call(raw_command:, stdin:, raw_env:, directory:)
  env = Environment.new(raw_env).to_h

  stdout, stderr, exit_status = Open3.capture3(
    env, raw_command, chdir: directory, stdin_data: stdin
  )

  ExecutedCommand.new(
    raw_command: raw_command,
    stdout: stdout,
    stderr: stderr,
    exit_status: exit_status,
  )
end