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

This commit is contained in:
Netkas 2023-07-11 20:56:40 -04:00
parent 277a09529e
commit 05b46296d7
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
2 changed files with 29 additions and 12 deletions

View file

@ -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

View file

@ -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)));