message: [now-cli] Clean up builder dev server shutdown logic
  DRY and removes the `pid` from the set immediately so there's no race
  condition if the server is shut down shortly after an HTTP request
  (like in the tests).
diff: @@ -920,17 +920,7 @@ export default class DevServer {
  }
  for (const pid of this.devServerPids) {
  - debug(`Killing builder dev server with PID ${pid}`);
  - ops.push(
  - treeKill(pid).then(
  - () => {
  - debug(`Killed builder dev server with PID ${pid}`);
  - },
  - (err: Error) => {
  - debug(`Failed to kill builder dev server with PID ${pid}: ${err}`);
  - }
  - )
  - );
  + ops.push(this.killBuilderDevServer(pid));
  }
  try {
  @@ -948,6 +938,18 @@ export default class DevServer {
  }
  }
  + async killBuilderDevServer(pid: number) {
  + const { debug } = this.output;
  + debug(`Killing builder dev server with PID ${pid}`);
  + this.devServerPids.delete(pid);
  + try {
  + await treeKill(pid);
  + debug(`Killed builder dev server with PID ${pid}`);
  + } catch (err) {
  + debug(`Failed to kill builder dev server with PID ${pid}: ${err}`);
  + }
  + }
  +
  async send404(
  req: http.IncomingMessage,
  res: http.ServerResponse,
  @@ -1496,19 +1498,7 @@ export default class DevServer {
  this.devServerPids.add(pid);
  res.once('close', () => {
  - debug(`Killing builder dev server with PID ${pid}`);
  - treeKill(pid).then(
  - () => {
  - this.devServerPids.delete(pid);
  - debug(`Killed builder dev server with PID ${pid}`);
  - },
  - (err: Error) => {
  - this.devServerPids.delete(pid);
  - debug(
  - `Failed to kill builder dev server with PID ${pid}: ${err}`
  - );
  - }
  - );
  + this.killBuilderDevServer(pid);
  });
  debug(
  