@base44-preview/cli 0.0.55-pr.545.ccfcbf3 → 0.0.55-pr.545.d908e49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -255490,6 +255490,7 @@ class ServeRunner {
255490
255490
  logger;
255491
255491
  child;
255492
255492
  stopping = false;
255493
+ stopPromise;
255493
255494
  exitListeners = [];
255494
255495
  constructor(options8) {
255495
255496
  this.command = options8.command;
@@ -255507,7 +255508,8 @@ class ServeRunner {
255507
255508
  shell: true,
255508
255509
  detached: process21.platform !== "win32",
255509
255510
  env: { ...process21.env, ...this.env },
255510
- stdio: [stdin2, "pipe", "pipe"]
255511
+ stdio: [stdin2, "pipe", "pipe"],
255512
+ windowsHide: true
255511
255513
  });
255512
255514
  this.child = child;
255513
255515
  this.setupHandlers(child);
@@ -255516,6 +255518,13 @@ class ServeRunner {
255516
255518
  this.exitListeners.push(listener);
255517
255519
  }
255518
255520
  async stop() {
255521
+ if (this.stopPromise) {
255522
+ return this.stopPromise;
255523
+ }
255524
+ this.stopPromise = this.stopChild();
255525
+ return this.stopPromise;
255526
+ }
255527
+ async stopChild() {
255519
255528
  const child = this.child;
255520
255529
  if (!child || child.exitCode !== null) {
255521
255530
  return;
@@ -255523,7 +255532,14 @@ class ServeRunner {
255523
255532
  this.stopping = true;
255524
255533
  const exited = new Promise((resolve10) => child.once("exit", () => resolve10()));
255525
255534
  if (process21.platform === "win32" && child.pid) {
255526
- spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"]);
255535
+ const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
255536
+ stdio: "ignore",
255537
+ windowsHide: true
255538
+ });
255539
+ await new Promise((resolve10) => {
255540
+ taskkill.once("exit", () => resolve10());
255541
+ taskkill.once("error", () => resolve10());
255542
+ });
255527
255543
  } else if (child.pid) {
255528
255544
  try {
255529
255545
  process21.kill(-child.pid, "SIGTERM");
@@ -257406,12 +257422,30 @@ async function createDevServer(options8) {
257406
257422
  logger: createDevLogger("frontend", theme.colors.base44Orange)
257407
257423
  });
257408
257424
  }
257409
- const shutdown = async () => {
257425
+ const closeServer = () => new Promise((resolve12, reject) => {
257426
+ server.close((error48) => {
257427
+ if (error48) {
257428
+ reject(error48);
257429
+ return;
257430
+ }
257431
+ resolve12();
257432
+ });
257433
+ });
257434
+ const handleShutdownError = (error48) => {
257435
+ const errorMessage = error48 instanceof Error ? error48.message : String(error48);
257436
+ devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
257437
+ };
257438
+ const runShutdown = async () => {
257410
257439
  base44ConfigWatcher.close();
257411
- io6.close();
257440
+ await io6.close();
257412
257441
  await functionManager.stopAll();
257413
257442
  await serveRunner?.stop();
257414
- server.close();
257443
+ await closeServer();
257444
+ };
257445
+ let shutdownPromise;
257446
+ const shutdown = () => {
257447
+ shutdownPromise ??= runShutdown().catch(handleShutdownError);
257448
+ return shutdownPromise;
257415
257449
  };
257416
257450
  process.on("SIGINT", shutdown);
257417
257451
  process.on("SIGTERM", shutdown);
@@ -261939,4 +261973,4 @@ export {
261939
261973
  CLIExitError
261940
261974
  };
261941
261975
 
261942
- //# debugId=38217A3EFC1ECB9764756E2164756E21
261976
+ //# debugId=B905F109B7865B3364756E2164756E21