mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-23 03:59:25 +01:00
Continue on bad daemon pid data
Summary: The rest of this code works if we hand off `array()`, and fataling here, while more correct, is harder for users to get out of (they have to go manually remove files) and not obvious. Test Plan: Corrupted pid file and ran `phd stop`. Reviewers: joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D9749
This commit is contained in:
parent
e096a227db
commit
950d81dac0
2 changed files with 16 additions and 2 deletions
|
@ -13,7 +13,7 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
|
||||||
protected $host;
|
protected $host;
|
||||||
protected $pid;
|
protected $pid;
|
||||||
protected $argv;
|
protected $argv;
|
||||||
protected $explicitArgv;
|
protected $explicitArgv = array();
|
||||||
protected $status;
|
protected $status;
|
||||||
|
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
|
@ -25,6 +25,14 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getExplicitArgv() {
|
||||||
|
$argv = $this->explicitArgv;
|
||||||
|
if (!is_array($argv)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
return $argv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,13 @@ final class PhabricatorDaemonReference {
|
||||||
|
|
||||||
public static function newFromFile($path) {
|
public static function newFromFile($path) {
|
||||||
$pid_data = Filesystem::readFile($path);
|
$pid_data = Filesystem::readFile($path);
|
||||||
$dict = phutil_json_decode($pid_data);
|
|
||||||
|
try {
|
||||||
|
$dict = phutil_json_decode($pid_data);
|
||||||
|
} catch (PhutilJSONParserException $ex) {
|
||||||
|
$dict = array();
|
||||||
|
}
|
||||||
|
|
||||||
$ref = self::newFromDictionary($dict);
|
$ref = self::newFromDictionary($dict);
|
||||||
$ref->pidFile = $path;
|
$ref->pidFile = $path;
|
||||||
return $ref;
|
return $ref;
|
||||||
|
|
Loading…
Add table
Reference in a new issue