Added patch for Non-Tty clients
This commit is contained in:
parent
fad7297532
commit
8a8efa4fe5
3 changed files with 45 additions and 2 deletions
|
@ -502,11 +502,30 @@
|
|||
'--filename=composer.phar'
|
||||
]));
|
||||
$Process->setWorkingDirectory($NCC_INSTALL_PATH);
|
||||
$Process->setTty(true);
|
||||
$Process->setTty(Functions::isTtyMode());
|
||||
|
||||
try
|
||||
{
|
||||
$Process->mustRun();
|
||||
if($Process->isTty())
|
||||
{
|
||||
$Process->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::outWarning('Composer is running in non-interactive mode, this may cause issues');
|
||||
|
||||
$Process->run(function ($type, $buffer)
|
||||
{
|
||||
if (Process::ERR === $type)
|
||||
{
|
||||
Console::outError($buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::out($buffer);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(ProcessFailedException $e)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
use ncc\ThirdParty\Symfony\Filesystem\Filesystem;
|
||||
use ncc\ThirdParty\Symfony\Process\Process;
|
||||
use ncc\Utilities\Console;
|
||||
use ncc\Utilities\Functions;
|
||||
use ncc\Utilities\IO;
|
||||
use ncc\Utilities\PathFinder;
|
||||
use ncc\Utilities\Resolver;
|
||||
|
@ -409,6 +410,12 @@
|
|||
$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);
|
||||
}
|
||||
|
||||
Console::outDebug(sprintf('working_directory=%s', $process->getWorkingDirectory()));
|
||||
Console::outDebug(sprintf('timeout=%s', ($process->getTimeout() ?? 0)));
|
||||
Console::outDebug(sprintf('silent=%s', ($unit->ExecutionPolicy->Execute->Silent ? 'true' : 'false')));
|
||||
|
|
|
@ -989,4 +989,21 @@ namespace ncc\Utilities;
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current process is running in TTY mode
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTtyMode(): bool
|
||||
{
|
||||
if(!is_null(RuntimeCache::get('posix_isatty')))
|
||||
return RuntimeCache::get('posix_isatty');
|
||||
|
||||
if(function_exists('posix_isatty') === false)
|
||||
return false;
|
||||
|
||||
RuntimeCache::set('posix_isatty', posix_isatty(STDOUT));
|
||||
return (bool)RuntimeCache::get('posix_isatty');
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue