Fix process related errors

This commit is contained in:
DariusIII
2023-03-02 20:54:39 +01:00
parent d58a9a6ac5
commit 8545217cc3
3 changed files with 16 additions and 7 deletions
+2 -2
View File
@@ -110,8 +110,8 @@ class TmuxOutput extends Tmux
{
$buffer = '';
$state = ((int) $this->runVar['settings']['is_running'] === 1) ? 'Running' : 'Disabled';
$version = Process::run('git describe --tags')->output();
$branch = Process::run('git branch')->output();
$version = str_replace(["\n", "\r"], '', Process::run('git describe --tags')->output());
$branch = str_replace(["\n", "\r"], '', Process::run('git branch --show-current')->output());
$buffer .= sprintf(
$this->tmpMasks[2],
+13 -4
View File
@@ -12,7 +12,7 @@ use Blacklight\processing\PostProcess;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Process;
use Symfony\Component\Process\Process;
use Opis\Closure\SerializableClosure;
use Spatie\Async\Output\SerializableException;
use Spatie\Async\Pool;
@@ -910,11 +910,20 @@ class Forking
//////////////////////////////////////////// Various methods ///////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected function _executeCommand(string $command): void
/**
* @param string $command
* @return string
*/
protected function _executeCommand(string $command): string
{
Process::timeout(config('nntmux.multiprocessing_max_child_time'))->run($command, function (string $type, string $output) {
echo $output;
$process = Process::fromShellCommandline($command);
$process->setTimeout(1800);
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo $buffer;
}
});
return $process->getOutput();
}
/**
+1 -1
View File
@@ -38,7 +38,7 @@ class TmuxUIStart extends Command
$session = Process::run("tmux list-session | grep $tmux_session");
if ($session->exitCode() === 1) {
$this->info('Starting the tmux server and monitor script');
Process::forever()->tty()->run('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/update/tmux/run.php');
Process::forever()->run('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/update/tmux/run.php');
}
}
}