INNER CODE UNIT · Ruby
self
EugenMayer/docker-sync · lib/docker-sync/command.rb:32
def self.run(*argv, dir: nil)
nopty = !defined?(PTY)
stdin_r, stdin = nopty ? IO.pipe : PTY.open
stdout, stdout_w = nopty ? IO.pipe : PTY.open
stderr, stderr_w = IO.pipe
chdir = dir || Dir.pwd
pid = spawn(*argv, in: stdin_r, out: stdout_w, err: stderr_w, chdir: chdir)
stdin_r.close
stdout_w.close
stderr_w.close
self.new(pid, stdin, stdout, stderr)
end
def initialize(pid, stdin, stdout, stderr)