diff --git a/src/Commands/core/SshCommands.php b/src/Commands/core/SshCommands.php index 2ae6f1d458..1f58225eb3 100644 --- a/src/Commands/core/SshCommands.php +++ b/src/Commands/core/SshCommands.php @@ -3,6 +3,7 @@ namespace Drush\Commands\core; use Consolidation\SiteProcess\Util\Shell; +use Consolidation\SiteProcess\Util\Tty; use Drush\Commands\DrushCommands; use Consolidation\SiteAlias\SiteAliasManagerAwareInterface; use Consolidation\SiteAlias\SiteAliasManagerAwareTrait; @@ -31,7 +32,7 @@ class SshCommands extends DrushCommands implements SiteAliasManagerAwareInterfac * @aliases ssh,site-ssh * @topics docs:aliases */ - public function ssh(array $code, $options = ['cd' => self::REQ, 'tty' => false]): void + public function ssh(array $code, $options = ['cd' => self::REQ]): void { $alias = $this->siteAliasManager()->getSelf(); @@ -49,7 +50,9 @@ public function ssh(array $code, $options = ['cd' => self::REQ, 'tty' => false]) } $process = $this->processManager()->siteProcess($alias, $code); - $process->setTty($options['tty']); + if (Tty::isTtySupported()) { + $process->setTty($options['tty']); + } // The transport handles the chdir during processArgs(). $fallback = $alias->hasRoot() ? $alias->root() : null; $process->setWorkingDirectory($options['cd'] ?: $fallback); diff --git a/tests/functional/SiteSshTest.php b/tests/functional/SiteSshTest.php index 89ef906bc6..bd45c22a4b 100644 --- a/tests/functional/SiteSshTest.php +++ b/tests/functional/SiteSshTest.php @@ -24,7 +24,7 @@ public function testInteractive() ]; $this->drush('ssh', [], $options, 'user@server/path/to/drupal#sitename'); $output = $this->getErrorOutput(); - $expected = "[notice] Simulating: ssh -t -o PasswordAuthentication=no user@server 'cd /path/to/drupal && bash -l'"; + $expected = "[notice] Simulating: ssh -o PasswordAuthentication=no user@server 'cd /path/to/drupal && bash -l'"; $this->assertStringContainsString($expected, $output); }