Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0.13] Supress Symphony exception when TTY is not available #226

Merged
merged 3 commits into from
Apr 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/Console/DuskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Console\Command;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\Exception\RuntimeException;

class DuskCommand extends Command
{
Expand Down Expand Up @@ -56,15 +57,21 @@ public function handle()
$options = array_slice($_SERVER['argv'], 2);

return $this->withDuskEnvironment(function () use ($options) {
return (new ProcessBuilder())
$process = (new ProcessBuilder())
->setTimeout(null)
->setPrefix($this->binary())
->setArguments($this->phpunitArguments($options))
->getProcess()
->setTty(PHP_OS !== 'WINNT')
->run(function ($type, $line) {
$this->output->write($line);
});
->getProcess();

try {
$process->setTty(true);
} catch (RuntimeException $e) {
$this->output->writeln('Warning: '.$e->getMessage());
}

return $process->run(function ($type, $line) {
$this->output->write($line);
});
});
}

Expand Down