Method: LearnTest::Strategy#run_install

Defined in:
lib/learn_test/strategy.rb

#run_install(command, npm_install: false) ⇒ Object

npm_install option added to fix the proxying of the npm install progress bar output.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/learn_test/strategy.rb', line 62

def run_install(command, npm_install: false)
  if npm_install
    system(command)
  else
    Open3.popen3(command) do |_, stdout, stderr, wait_thr|
      while out = stdout.gets do
        puts out
      end

      while err = stderr.gets do
        puts err
      end

      if wait_thr.value.exitstatus != 0
        die("There was an error running #{command}")
      end
    end
  end
end