From 1b8f6a0f0bbe8bbea6119433762b7b6dfc97aa5a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 3 Oct 2023 23:59:33 +0200 Subject: [PATCH] Don't use PTY on Windows. --- lib/command.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/command.rb b/lib/command.rb index f38234d4..9df8a58a 100644 --- a/lib/command.rb +++ b/lib/command.rb @@ -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 @@ -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]