mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-11 20:19:36 +00:00
Try to emulate nohup behavior on windows
This commit is contained in:
parent
720c1e51e8
commit
7a856bf6f1
1 changed files with 20 additions and 9 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue