MCPcopy Create free account
hub / github.com/vercel/vercel / stop

Method stop

packages/cli/src/util/dev/server.ts:1273–1320  ·  view source on GitHub ↗

* Shuts down the `vercel dev` server, and cleans up any temporary resources.

(exitCode?: number)

Source from the content-addressed store, hash-verified

1271 * Shuts down the `vercel dev` server, and cleans up any temporary resources.
1272 */
1273 async stop(exitCode?: number): Promise<void> {
1274 if (this.stopping) return;
1275 this.stopping = true;
1276
1277 const { devProcess } = this;
1278 const { debug } = output;
1279 const ops: Promise<any>[] = [];
1280
1281 for (const match of this.buildMatches.values()) {
1282 ops.push(shutdownBuilder(match));
1283 }
1284
1285 if (devProcess) {
1286 ops.push(treeKill(devProcess.pid!));
1287 }
1288
1289 if (this.orchestrator) {
1290 ops.push(this.orchestrator.stopAll());
1291 }
1292
1293 if (this.queueBroker) {
1294 this.queueBroker.stop();
1295 }
1296
1297 ops.push(close(this.server));
1298
1299 if (this.watcher) {
1300 debug(`Closing file watcher`);
1301 const closePromise = this.watcher.close();
1302 if (closePromise) {
1303 ops.push(closePromise);
1304 }
1305 }
1306
1307 for (const pid of this.shutdownCallbacks.keys()) {
1308 ops.push(this.killBuilderDevServer(pid));
1309 }
1310
1311 try {
1312 await Promise.all(ops);
1313 } catch (err: unknown) {
1314 if (isErrnoException(err) && err.code === 'ERR_SERVER_NOT_RUNNING') {
1315 process.exit(exitCode || 0);
1316 } else {
1317 throw err;
1318 }
1319 }
1320 }
1321
1322 async killBuilderDevServer(pid: number) {
1323 const { debug } = output;

Callers 5

exitMethod · 0.95
startMethod · 0.95
saveTelemetryFunction · 0.45
cleanupFunction · 0.45
stopFunction · 0.45

Calls 12

killBuilderDevServerMethod · 0.95
shutdownBuilderFunction · 0.90
treeKillFunction · 0.90
isErrnoExceptionFunction · 0.90
stopAllMethod · 0.80
closeFunction · 0.70
pushMethod · 0.65
debugFunction · 0.50
valuesMethod · 0.45
closeMethod · 0.45
keysMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected