Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/__tests__/PhutilFileLockTestCase.php
| Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | while (!$future->isReady()) { | ||||
| if (strpos($buf, 'LOCK ACQUIRED') !== false) { | if (strpos($buf, 'LOCK ACQUIRED') !== false) { | ||||
| return $future; | return $future; | ||||
| } | } | ||||
| } | } | ||||
| throw new Exception(pht('Unable to hold lock in external process!')); | throw new Exception(pht('Unable to hold lock in external process!')); | ||||
| } | } | ||||
| private function buildLockFuture($flags, $file) { | private function buildLockFuture(/* ... */) { | ||||
| $root = dirname(phutil_get_library_root('arcanist')); | $argv = func_get_args(); | ||||
| $bin = $root.'/support/test/lock-file.php'; | $bin = $this->getSupportExecutable('lock'); | ||||
| $flags = (array)$flags; | if (phutil_is_windows()) { | ||||
| $future = new ExecFuture('php -f %R -- %Ls', $bin, $argv); | |||||
| // NOTE: Use `exec` so this passes on Ubuntu, where the default `dash` shell | } else { | ||||
| // will eat any kills we send during the tests. | // NOTE: Use `exec` so this passes on Ubuntu, where the default `dash` | ||||
| $future = new ExecFuture('exec php -f %R -- %Ls %R', $bin, $flags, $file); | // shell will eat any kills we send during the tests. | ||||
| $future = new ExecFuture('exec php -f %R -- %Ls', $bin, $argv); | |||||
| } | |||||
| $future->start(); | $future->start(); | ||||
| return $future; | return $future; | ||||
| } | } | ||||
| } | } | ||||