mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +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 $pid;
|
||||
protected $argv;
|
||||
protected $explicitArgv;
|
||||
protected $explicitArgv = array();
|
||||
protected $status;
|
||||
|
||||
public function getConfiguration() {
|
||||
|
@ -25,6 +25,14 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
|
|||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
public function getExplicitArgv() {
|
||||
$argv = $this->explicitArgv;
|
||||
if (!is_array($argv)) {
|
||||
return array();
|
||||
}
|
||||
return $argv;
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -12,7 +12,13 @@ final class PhabricatorDaemonReference {
|
|||
|
||||
public static function newFromFile($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->pidFile = $path;
|
||||
return $ref;
|
||||
|
|
Loading…
Reference in a new issue