Skip to content

Commit 7ce3923

Browse files
authored
Don't pass --no-ansi to rm, properly check if output is a TTY (#437)
* Don't pass --no-ansi to rm When --force is used, rm is part of $commands. rm something --no-ansi succeeds on macOS but fails on Linux. * Properly check if output is a TTY This now matches the check setTty() does. Previously we were only checking the directory separator and that /dev/tty exists and is readable. isTtySupported() checks if /dev/tty is *writable* and more importantly that STDOUT itself is a TTY. Simply running `laravel new --stuff foo | head` would produce TTY warns on systems where /dev/tty exists just fine and only stdout is piped.
1 parent 42ed825 commit 7ce3923

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/NewCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ protected function runCommands($commands, InputInterface $input, OutputInterface
908908
{
909909
if (! $output->isDecorated()) {
910910
$commands = array_map(function ($value) {
911-
if (Str::startsWith($value, ['chmod', 'git', $this->phpBinary().' ./vendor/bin/pest'])) {
911+
if (Str::startsWith($value, ['chmod', 'rm', 'git', $this->phpBinary().' ./vendor/bin/pest'])) {
912912
return $value;
913913
}
914914

@@ -918,7 +918,7 @@ protected function runCommands($commands, InputInterface $input, OutputInterface
918918

919919
if ($input->getOption('quiet')) {
920920
$commands = array_map(function ($value) {
921-
if (Str::startsWith($value, ['chmod', 'git', $this->phpBinary().' ./vendor/bin/pest'])) {
921+
if (Str::startsWith($value, ['chmod', 'rm', 'git', $this->phpBinary().' ./vendor/bin/pest'])) {
922922
return $value;
923923
}
924924

@@ -928,7 +928,7 @@ protected function runCommands($commands, InputInterface $input, OutputInterface
928928

929929
$process = Process::fromShellCommandline(implode(' && ', $commands), $workingPath, $env, null, null);
930930

931-
if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
931+
if (Process::isTtySupported()) {
932932
try {
933933
$process->setTty(true);
934934
} catch (RuntimeException $e) {

0 commit comments

Comments
 (0)