Skip to content

Commit b9330ed

Browse files
committed
Return on process exit
1 parent e2d5e83 commit b9330ed

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

packages/cli-v3/src/commands/deploy.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const DeployCommandOptions = CommonCommandOptions.extend({
7979
push: z.boolean().optional(),
8080
builder: z.string().default("trigger"),
8181
nativeBuildServer: z.boolean().default(false),
82+
detach: z.boolean().default(false),
8283
});
8384

8485
type DeployCommandOptions = z.infer<typeof DeployCommandOptions>;
@@ -177,6 +178,12 @@ export function configureDeployCommand(program: Command) {
177178
"Use the native build server for building the image"
178179
)
179180
)
181+
.addOption(
182+
new CommandOption(
183+
"--detach",
184+
"Return immediately after the deployment is queued, do not wait for the build to complete. Implies using the native build server."
185+
).implies({ nativeBuildServer: true })
186+
)
180187
.action(async (path, options) => {
181188
await handleTelemetry(async () => {
182189
await printStandloneInitialBanner(true);
@@ -988,14 +995,19 @@ async function handleNativeBuildServerDeploy({
988995
},
989996
});
990997

998+
if (options.detach) {
999+
outro(`Version ${deployment.version} is being deployed`);
1000+
return;
1001+
}
1002+
9911003
const { eventStream } = deployment;
9921004

9931005
if (!eventStream) {
9941006
log.warn(`Failed streaming build logs, open the deployment in the dashboard to view the logs`);
9951007

9961008
outro(`Version ${deployment.version} is being deployed`);
9971009

998-
process.exit(0);
1010+
return process.exit(0);
9991011
}
10001012

10011013
const $queuedSpinner = spinner({
@@ -1031,7 +1043,7 @@ async function handleNativeBuildServerDeploy({
10311043
}`
10321044
);
10331045

1034-
return;
1046+
return process.exit(0);
10351047
}
10361048

10371049
const decoder = new TextDecoder();
@@ -1150,7 +1162,7 @@ async function handleNativeBuildServerDeploy({
11501162
: ""
11511163
}`
11521164
);
1153-
process.exit(0);
1165+
return process.exit(0);
11541166
}
11551167
case "failed": {
11561168
queuedSpinnerStopped
@@ -1218,7 +1230,7 @@ async function handleNativeBuildServerDeploy({
12181230
: ""
12191231
}`
12201232
);
1221-
process.exit(0);
1233+
return process.exit(0);
12221234
}
12231235
}
12241236
}

0 commit comments

Comments
 (0)