Changeset View
Changeset View
Standalone View
Standalone View
src/filesystem/PhutilProcessQuery.php
Show All 29 Lines | public function execute() { | ||||
list($processes) = execx('ps -o pid,command -a -x -w -w -w'); | list($processes) = execx('ps -o pid,command -a -x -w -w -w'); | ||||
$processes = phutil_split_lines($processes, false); | $processes = phutil_split_lines($processes, false); | ||||
$refs = array(); | $refs = array(); | ||||
foreach ($processes as $process) { | foreach ($processes as $process) { | ||||
$parts = preg_split('/\s+/', trim($process), 2); | $parts = preg_split('/\s+/', trim($process), 2); | ||||
list($pid, $command) = $parts; | list($pid, $command) = $parts; | ||||
$ref = id(new PhutilProcessRef()) | $ref = (new PhutilProcessRef()) | ||||
->setPID((int)$pid); | ->setPID((int)$pid); | ||||
$argv = $this->getArgv($pid, $command); | $argv = $this->getArgv($pid, $command); | ||||
$ref->setArgv($argv); | $ref->setArgv($argv); | ||||
// If this is an overseer and the command has a "-l" ("Label") argument, | // If this is an overseer and the command has a "-l" ("Label") argument, | ||||
// the argument contains the "PHABRICATOR_INSTANCE" value for the daemon. | // the argument contains the "PHABRICATOR_INSTANCE" value for the daemon. | ||||
// Parse it out and annotate the process. | // Parse it out and annotate the process. | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0