visual-exec 1.1.5 → 1.1.6

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.
@@ -26,8 +26,6 @@ function createAbortError(context) {
26
26
  return err;
27
27
  }
28
28
  function lastLines(text, n) {
29
- if (!text)
30
- return [];
31
29
  const lines = text.split("\n").filter(Boolean);
32
30
  return lines.slice(-n);
33
31
  }
@@ -176,15 +174,13 @@ export class VisualExec {
176
174
  }
177
175
  return `Running ${command}`;
178
176
  }
179
- _createOutputFileStream() {
180
- if (typeof this._outputFile !== "string")
181
- return undefined;
177
+ _createOutputFileStream(outputFile) {
182
178
  const flags = this._outputFileOptions.append ? "a" : "w";
183
- const dir = path.dirname(this._outputFile);
179
+ const dir = path.dirname(outputFile);
184
180
  if (!fs.existsSync(dir)) {
185
181
  fs.mkdirSync(dir, { recursive: true });
186
182
  }
187
- return fs.createWriteStream(this._outputFile, { flags });
183
+ return fs.createWriteStream(outputFile, { flags });
188
184
  }
189
185
  _writeToOutputFile(data, stream) {
190
186
  var _a;
@@ -334,7 +330,7 @@ export class VisualExec {
334
330
  child.stderr.on("data", this._onStderrData);
335
331
  this._child = child;
336
332
  if (typeof this._outputFile === "string") {
337
- this._outputStream = this._createOutputFileStream();
333
+ this._outputStream = this._createOutputFileStream(this._outputFile);
338
334
  }
339
335
  else if (this._outputFile) {
340
336
  this._outputStream = undefined;
@@ -508,6 +504,7 @@ export class VisualExec {
508
504
  child: result.child
509
505
  };
510
506
  const duration = () => Date.now() - this._startTime;
507
+ /* v8 ignore next -- @preserve Every field is overwritten in the context below. */
511
508
  const baseContext = (output) => { var _a, _b, _c, _d; return ({
512
509
  command: cmd,
513
510
  cwd: this._cwd,
@@ -521,7 +518,8 @@ export class VisualExec {
521
518
  var _b, _c, _d, _e;
522
519
  const output = (_b = err.output) !== null && _b !== void 0 ? _b : { stdout: "", stderr: "" };
523
520
  const exitCode = (_c = err.code) !== null && _c !== void 0 ? _c : 1;
524
- const signal = (_e = (_d = err.signal) !== null && _d !== void 0 ? _d : (((_a = result.child) === null || _a === void 0 ? void 0 : _a.killed) ? "SIGTERM" : null)) !== null && _e !== void 0 ? _e : null;
521
+ const signal = (_e = (_d = err.signal) !== null && _d !== void 0 ? _d : (((_a = result.child) === null || _a === void 0 ? void 0 : _a.killed) ? "SIGTERM" : null)) !== null && _e !== void 0 ? _e :
522
+ /* v8 ignore next -- @preserve The preceding fallback already returns null. */ null;
525
523
  const context = {
526
524
  ...baseContext(output),
527
525
  exitCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visual-exec",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "homepage": "https://github.com/jchip/fynjs/tree/main/packages/visual-exec",
5
5
  "description": "Visual shell exec with spinners and progress display",
6
6
  "type": "module",
@@ -49,14 +49,14 @@
49
49
  "ci-info": "^4.4.0",
50
50
  "has-ansi": "^6.0.2",
51
51
  "strip-ansi": "^7.2.0",
52
- "visual-logger": "^2.1.4",
53
- "xsh": "^1.1.4"
52
+ "visual-logger": "^2.1.5",
53
+ "xsh": "^1.1.5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^26.4.1",
57
57
  "@vitest/coverage-v8": "^5.0.0",
58
- "publish-util": "^3.1.3",
59
- "run-verify": "^2.1.4",
58
+ "publish-util": "^3.1.4",
59
+ "run-verify": "^2.1.5",
60
60
  "typescript": "^7.0.2",
61
61
  "vite": "^8.2.2",
62
62
  "vitest": "^5.0.0"