@percy/cli-exec 1.31.13-beta.0 → 1.31.14-beta.0

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/exec.js CHANGED
@@ -39,7 +39,8 @@ export const exec = command('exec', {
39
39
  env,
40
40
  percy,
41
41
  log,
42
- exit
42
+ exit,
43
+ shutdown
43
44
  }) {
44
45
  var _percy$build, _percy$build2;
45
46
  let [command, ...args] = argv;
@@ -93,8 +94,12 @@ export const exec = command('exec', {
93
94
  log.info(`Running "${[command, ...args].join(' ')}"`);
94
95
  let [status, error] = yield* spawn(command, args, percy);
95
96
 
96
- // stop percy if running (force stop if there is an error);
97
- await (percy === null || percy === void 0 ? void 0 : percy.stop(!!error));
97
+ // stop percy if running. When the spawn child was signaled
98
+ // (error.signal truthy from cross-spawn), respect the
99
+ // graceful drain budget exposed via ctx.shutdown; otherwise, the
100
+ // legacy "force-stop on any error" rule still applies.
101
+ let force = error !== null && error !== void 0 && error.signal ? !!(shutdown !== null && shutdown !== void 0 && shutdown.forced) : !!error;
102
+ await (percy === null || percy === void 0 ? void 0 : percy.stop(force));
98
103
  log.info(`Command "${[command, ...args].join(' ')}" exited with status: ${status}`);
99
104
  // forward any returned status code
100
105
  if (status) exit(status, error, false);
package/dist/start.js CHANGED
@@ -9,7 +9,8 @@ export const start = command('start', {
9
9
  }, async function* ({
10
10
  percy,
11
11
  log,
12
- exit
12
+ exit,
13
+ shutdown
13
14
  }) {
14
15
  if (!percy) exit(0, 'Percy is disabled');
15
16
  let {
@@ -31,7 +32,13 @@ export const start = command('start', {
31
32
  yield* yieldFor(() => percy.readyState >= 3);
32
33
  } catch (error) {
33
34
  log.error(error);
34
- await percy.stop(true);
35
+ // On a signal-driven exit, respect the graceful drain budget —
36
+ // first SIGINT/SIGTERM stops with force=false so
37
+ // in-flight uploads finish; second signal (or 30s drain timeout)
38
+ // flips shutdown.forced to true and we hard-stop. Non-signal
39
+ // errors preserve the original force-stop behavior.
40
+ let force = error.signal ? !!(shutdown !== null && shutdown !== void 0 && shutdown.forced) : true;
41
+ await percy.stop(force);
35
42
  throw error;
36
43
  }
37
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/cli-exec",
3
- "version": "1.31.13-beta.0",
3
+ "version": "1.31.14-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,10 +33,10 @@
33
33
  ]
34
34
  },
35
35
  "dependencies": {
36
- "@percy/cli-command": "1.31.13-beta.0",
37
- "@percy/logger": "1.31.13-beta.0",
36
+ "@percy/cli-command": "1.31.14-beta.0",
37
+ "@percy/logger": "1.31.14-beta.0",
38
38
  "cross-spawn": "^7.0.3",
39
39
  "which": "^2.0.2"
40
40
  },
41
- "gitHead": "69c6ad10d5724455cebf57f2043adc30559c3b31"
41
+ "gitHead": "a87281473a9f5cb69a3030845cc4d6b4b81509b0"
42
42
  }