Class: CobraCommander::Executor::IsolatedPTY

Inherits:
TTY::Command
  • Object
show all
Defined in:
lib/cobra_commander/executor/isolated_pty.rb

Overview

Executes commands in a clean environment, without the influence of the current Bundler env vars.

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ IsolatedPTY

Returns a new instance of IsolatedPTY.



10
11
12
# File 'lib/cobra_commander/executor/isolated_pty.rb', line 10

def initialize(**kwargs)
  super(pty: true, **kwargs)
end

Instance Method Details

#isolate_bundle(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/cobra_commander/executor/isolated_pty.rb', line 20

def isolate_bundle(&block)
  if Bundler.respond_to?(:with_unbundled_env)
    Bundler.with_unbundled_env(&block)
  else
    Bundler.with_clean_env(&block)
  end
end

#run!Object



14
15
16
17
18
# File 'lib/cobra_commander/executor/isolated_pty.rb', line 14

def run!(...)
  isolate_bundle do
    super(...)
  end
end