diff --git a/src/Symfony/Component/Console/Cursor.php b/src/Symfony/Component/Console/Cursor.php index a6b05d8514f76..ce38c9d89f0e4 100644 --- a/src/Symfony/Component/Console/Cursor.php +++ b/src/Symfony/Component/Console/Cursor.php @@ -20,9 +20,12 @@ class Cursor { private $output; - public function __construct(OutputInterface $output) + private $input; + + public function __construct(OutputInterface $output, $input = STDIN) { $this->output = $output; + $this->input = $input; } public function moveUp(int $lines = 1) @@ -121,9 +124,9 @@ public function getCurrentPosition(): array $sttyMode = shell_exec('stty -g'); shell_exec('stty -icanon -echo'); - fwrite(STDIN, "\033[6n"); + fwrite($this->input, "\033[6n"); - $code = trim(fread(STDIN, 1024)); + $code = trim(fread($this->input, 1024)); shell_exec(sprintf('stty %s', $sttyMode));