HomePhabricator

Make parsing of daemon PIDs more robust

Description

Make parsing of daemon PIDs more robust

Summary:
In production on the cluster, we get output like this:

  1 process1
 22 process2
333 process3

That is, the PIDs are right-aligned. In this case, the explode(...) splits the line " 1 process1" on the first space, and we end up with an empty PID.

We later try to kill PID 0, which kills us.

Instead, trim.

Also, be slightly more liberal in splitting.

Test Plan: Ran phd stop --force in production, saw daemons get killed instead of the process itself.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11786

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Feb 17 2015, 10:20 PM
Reviewer
btrahan
Differential Revision
D11786: Make parsing of daemon PIDs more robust
Parents
rPHUe99f07349e7d: Phabricator OAuth - tweak Phabricator Oauth adapter
Branches
Unknown
Tags
Unknown