DE
apps/winzik / tests / fixtures / relaunch-old.php · commit 6576d6f
<?php// The old WinZik of RelaunchTest: holds the lock, starts the new one (Relaunch, or the old way: $argv[3] = 'old'), ends 1 s later.require __DIR__ . '/../../vendor/autoload.php';[, $lockFile, $result, $how] = $argv;$lock = $how === 'old' ? fopen($lockFile, 'c+') : \App\Core\Relaunch::takeLock($lockFile);if ($how === 'old') {    flock($lock, LOCK_EX);}$new = [PHP_BINARY, __DIR__ . '/relaunch-new.php', $lockFile, $result, $how];if ($how === 'old') {    proc_open(['/bin/sh', '-c', 'sleep 1; exec "$@"', 'sh', ...$new], [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['file', '/dev/null', 'w']], $pipes);} else {    \App\Core\Relaunch::afterExit($new);}usleep(1000000);exit(0);