From 188409f22618b54800f5eeb1aa370b70c005ed9b Mon Sep 17 00:00:00 2001 From: Chung Leong Date: Mon, 19 Oct 2026 17:48:54 +0200 Subject: [PATCH] Added code making use of Windows workaround --- src/Terminal/TerminalFactory.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Terminal/TerminalFactory.php b/src/Terminal/TerminalFactory.php index 7aa76fa..e3e6059 100644 --- a/src/Terminal/TerminalFactory.php +++ b/src/Terminal/TerminalFactory.php @@ -4,6 +4,7 @@ namespace PhpSchool\CliMenu\Terminal; +use PhpSchool\Terminal\IO\PowerShellInputStream; use PhpSchool\Terminal\IO\ResourceInputStream; use PhpSchool\Terminal\IO\ResourceOutputStream; use PhpSchool\Terminal\Terminal; @@ -16,6 +17,12 @@ class TerminalFactory { public static function fromSystem(): Terminal { - return new UnixTerminal(new ResourceInputStream(), new ResourceOutputStream()); + if (PHP_OS_FAMILY === 'Windows') { + $input = new PowerShellInputStream(); + } else { + $input = new ResourceInputStream(); + } + $output = new ResourceOutputStream(); + return new UnixTerminal($input, $output); } }