Try to emulate nohup behavior on windows

This commit is contained in:
Jan Böhmer 2026-02-02 20:37:02 +01:00
parent 720c1e51e8
commit 7a856bf6f1

View file

@ -835,6 +835,16 @@ class UpdateExecutor
$this->filesystem->mkdir($logDir, 0755); $this->filesystem->mkdir($logDir, 0755);
} }
//If we are on Windows, we cannot use nohup
if (PHP_OS_FAMILY === 'Windows') {
$command = sprintf(
'start /B php %s partdb:update %s %s --force --no-interaction >> %s 2>&1',
escapeshellarg($consolePath),
escapeshellarg($targetVersion),
$createBackup ? '' : '--no-backup',
escapeshellarg($logFile)
);
} else { //Unix like platforms should be able to use nohup
// Use nohup to properly detach the process from the web request // Use nohup to properly detach the process from the web request
// The process will continue running even after the PHP request ends // The process will continue running even after the PHP request ends
$command = sprintf( $command = sprintf(
@ -844,6 +854,7 @@ class UpdateExecutor
$createBackup ? '' : '--no-backup', $createBackup ? '' : '--no-backup',
escapeshellarg($logFile) escapeshellarg($logFile)
); );
}
$this->logger->info('Starting background update', [ $this->logger->info('Starting background update', [
'command' => $command, 'command' => $command,