Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Console] Consider STDIN interactive
- Loading branch information
1 parent
54e1cf9
commit 55b6ebf
Showing
3 changed files
with
29 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ | |
use Symfony\Component\Console\Input\InputDefinition; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\StreamableInputInterface; | ||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
use Symfony\Component\Console\Output\ConsoleOutputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
@@ -947,16 +946,6 @@ protected function configureIO(InputInterface $input, OutputInterface $output) | |
|
||
if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) { | ||
$input->setInteractive(false); | ||
} elseif (\function_exists('posix_isatty')) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
danepowell
Contributor
|
||
$inputStream = null; | ||
|
||
if ($input instanceof StreamableInputInterface) { | ||
$inputStream = $input->getStream(); | ||
} | ||
|
||
if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { | ||
$input->setInteractive(false); | ||
} | ||
} | ||
|
||
switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--STDIN-- | ||
Hello World | ||
--FILE-- | ||
<?php | ||
|
||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Helper\QuestionHelper; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Question\Question; | ||
|
||
$vendor = __DIR__; | ||
while (!file_exists($vendor.'/vendor')) { | ||
$vendor = \dirname($vendor); | ||
} | ||
require $vendor.'/vendor/autoload.php'; | ||
|
||
(new Application()) | ||
->register('app') | ||
->setCode(function(InputInterface $input, OutputInterface $output) { | ||
$output->writeln((new QuestionHelper())->ask($input, $output, new Question('Foo?'))); | ||
}) | ||
->getApplication() | ||
->setDefaultCommand('app', true) | ||
->run() | ||
; | ||
--EXPECT-- | ||
Foo?Hello World |
That is a really hard BC... You can't do that on a minor with nothing in the changelog !