MDL-87905 Behat: pause incorrectly thinks terminal not interactive
When run from behat/cli/run.php, the pause command may fail because it thinks the terminal is not interactive, even if the input and output is passed through from an interactive terminal run.
This commit is contained in:
@@ -224,6 +224,11 @@ if (empty($parallelrun)) {
|
||||
$cmds['singlerun'] = $runtestscommand;
|
||||
|
||||
echo "Running single behat site:" . PHP_EOL;
|
||||
// The inner PHP process is not marked as having an interactive terminal even if it's passed
|
||||
// through from this one which does, so we need to pass it through as an environment variable.
|
||||
if (function_exists('posix_isatty') && posix_isatty(STDOUT)) {
|
||||
putenv('MOODLE_BEHAT_RUNNING_IN_TTY=1');
|
||||
}
|
||||
passthru("php $runtestscommand", $status);
|
||||
$exitcodes['singlerun'] = $status;
|
||||
chdir($cwd);
|
||||
|
||||
@@ -486,7 +486,7 @@ class behat_util extends testing_util {
|
||||
$posixexists = function_exists('posix_isatty');
|
||||
|
||||
// Make sure this step is only used with interactive terminal (if detected).
|
||||
if ($posixexists && !@posix_isatty(STDOUT)) {
|
||||
if ($posixexists && !@posix_isatty(STDOUT) && getenv('MOODLE_BEHAT_RUNNING_IN_TTY') !== '1') {
|
||||
throw new ExpectationException('Break point should only be used with interactive terminal.', $session);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user