Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0f7bf41

Browse filesBrowse files
committed
[Console] Detect if interactive mode is possible at all
1 parent d171d39 commit 0f7bf41
Copy full SHA for 0f7bf41

File tree

2 files changed

+17
-0
lines changed
Filter options

2 files changed

+17
-0
lines changed

‎src/Symfony/Component/Console/Application.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Application.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ public function doRun(InputInterface $input, OutputInterface $output)
170170
$input->setInteractive(false);
171171
}
172172

173+
if (function_exists('posix_isatty')) {
174+
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
175+
if (!@posix_isatty($inputStream)) {
176+
$input->setInteractive(false);
177+
}
178+
}
179+
173180
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
174181
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
175182
} elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {

‎src/Symfony/Component/Console/Helper/DialogHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/DialogHelper.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ public function setInputStream($stream)
117117
$this->inputStream = $stream;
118118
}
119119

120+
/**
121+
* Returns the helper's input stream
122+
*
123+
* @return string
124+
*/
125+
public function getInputStream()
126+
{
127+
return $this->inputStream;
128+
}
129+
120130
/**
121131
* Returns the helper's canonical name
122132
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.