diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e8ec2a..68683e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated `defuse\php-encryption` to version 2.4.0 - Updated `\ncc\Classes > GitClient > cloneRepositor()` to clone submodules recursively by default +### Fixed + - Fixed issue in `\ncc\Managers > ExecutionPointerManager > executeUnit()` where if ttyMode is enabled in a non-tty + environment, the process will throw an exception + "/etc/ncc/ThirdParty/Symfony/Process/Process.php:1019 Error: TTY mode requires /dev/tty to be read/writable.", now + ncc will display a warning if TTY mode cannot be enabled + ## [1.0.2] - 2023-06-29 diff --git a/src/ncc/Managers/ExecutionPointerManager.php b/src/ncc/Managers/ExecutionPointerManager.php index a517cb9..947908c 100644 --- a/src/ncc/Managers/ExecutionPointerManager.php +++ b/src/ncc/Managers/ExecutionPointerManager.php @@ -400,26 +400,37 @@ $process->setTimeout(null); } - if($unit->ExecutionPolicy->Execute->Silent) + try { - $process->disableOutput(); - $process->setTty(false); + if($unit->ExecutionPolicy->Execute->Silent) + { + $process->disableOutput(); + $process->setTty(false); + } + elseif($unit->ExecutionPolicy->Execute->Tty) + { + $process->enableOutput(); + $process->setTty(true); + } + else + { + $process->enableOutput(); + } } - elseif($unit->ExecutionPolicy->Execute->Tty) + catch(Exception $e) { $process->enableOutput(); - $process->setTty(true); + Console::outWarning('The process is configured to use a TTY, but the current environment does not support it'); } - else + finally { - $process->enableOutput(); + if($process->isTty() && !Functions::isTtyMode()) + { + Console::outWarning('The process is configured to use a TTY, but the current environment does not support it'); + $process->setTty(false); + } } - if($process->isTty() && !Functions::isTtyMode()) - { - Console::outWarning('The process is configured to use a TTY, but the current environment does not support it'); - $process->setTty(false); - } Console::outDebug(sprintf('working_directory=%s', $process->getWorkingDirectory())); Console::outDebug(sprintf('timeout=%s', ($process->getTimeout() ?? 0)));