Skip to content

Commit

Permalink
Don't use PTY on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus authored Oct 3, 2023
1 parent 2898522 commit 1b8f6a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

require 'English'
require 'open3'
require 'pty'
require 'windows'
require 'pty' unless windows?

class NonZeroExit < RuntimeError
attr_reader :command, :stdout, :stderr, :merged_output, :status
Expand All @@ -29,10 +30,10 @@ def popen(*args, stdout_tty: false, stderr_tty: false, **opts)
opts[:in] = in_r
in_w.sync = true

out_r, out_w = stdout_tty ? PTY.open : IO.pipe
out_r, out_w = stdout_tty && !windows? ? PTY.open : IO.pipe
opts[:out] = out_w

err_r, err_w = stderr_tty ? PTY.open : IO.pipe
err_r, err_w = stderr_tty && !windows? ? PTY.open : IO.pipe
opts[:err] = err_w

parent_io = [in_w, out_r, err_r]
Expand Down

0 comments on commit 1b8f6a0

Please sign in to comment.