From 5fd9fea20d2d59ffb1aae53223d3d0438403dd4d Mon Sep 17 00:00:00 2001 From: Timo Uhlmann Date: Thu, 16 Nov 2023 11:27:14 +0100 Subject: [PATCH 1/3] Don't enable tty if `no-interaction` option is true --- src/Concerns/RunsCommands.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Concerns/RunsCommands.php b/src/Concerns/RunsCommands.php index 0e450e4..d27a2a5 100644 --- a/src/Concerns/RunsCommands.php +++ b/src/Concerns/RunsCommands.php @@ -51,7 +51,11 @@ protected function runCommands($commands, $disableOutput = false) if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) { try { - $process->setTty(true); + if ($this->input->hasOption('no-interaction') && $this->input->getOption('no-interaction')) { + $process->setTty(false); + } else { + $process->setTty(true); + } } catch (RuntimeException $e) { $this->output->writeln('Warning: '.$e->getMessage()); } From e92fd32dc7130acdffbbbc7147b1495774fea5aa Mon Sep 17 00:00:00 2001 From: Timo Uhlmann Date: Thu, 16 Nov 2023 11:28:08 +0100 Subject: [PATCH 2/3] Skip `rm` command when modifying options --- src/Concerns/RunsCommands.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/RunsCommands.php b/src/Concerns/RunsCommands.php index d27a2a5..f78d80e 100644 --- a/src/Concerns/RunsCommands.php +++ b/src/Concerns/RunsCommands.php @@ -29,7 +29,7 @@ protected function runCommands($commands, $disableOutput = false) { if (! $this->output->isDecorated()) { $commands = array_map(function ($value) { - if (substr($value, 0, 5) === 'chmod') { + if (substr($value, 0, 5) === 'chmod' || substr($value, 0, 3) === 'rm ') { return $value; } @@ -39,7 +39,7 @@ protected function runCommands($commands, $disableOutput = false) if ($this->input->getOption('quiet')) { $commands = array_map(function ($value) { - if (substr($value, 0, 5) === 'chmod') { + if (substr($value, 0, 5) === 'chmod' || substr($value, 0, 3) === 'rm ') { return $value; } From e13d57a6670a5ada6a438b77fac65d700d42fdca Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Thu, 24 Oct 2024 17:15:51 -0400 Subject: [PATCH 3/3] out of scope --- src/Concerns/RunsCommands.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Concerns/RunsCommands.php b/src/Concerns/RunsCommands.php index 6775a59..73dce94 100644 --- a/src/Concerns/RunsCommands.php +++ b/src/Concerns/RunsCommands.php @@ -25,7 +25,7 @@ protected function runCommands(array $commands, ?string $workingPath = null, boo { if (! $this->output->isDecorated()) { $commands = array_map(function ($value) { - if (str_starts_with($value, 'chmod') || str_starts_with($value, 'rm ')) { + if (str_starts_with($value, 'chmod')) { return $value; } @@ -39,7 +39,7 @@ protected function runCommands(array $commands, ?string $workingPath = null, boo if ($this->input->getOption('quiet')) { $commands = array_map(function ($value) { - if (str_starts_with($value, 'chmod') || str_starts_with($value, 'rm ')) { + if (str_starts_with($value, 'chmod')) { return $value; }