@coana-tech/cli 14.12.128 → 14.12.129

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/cli.mjs CHANGED
@@ -251101,7 +251101,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251101
251101
  }
251102
251102
 
251103
251103
  // dist/version.js
251104
- var version3 = "14.12.128";
251104
+ var version3 = "14.12.129";
251105
251105
 
251106
251106
  // dist/cli-core.js
251107
251107
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
@@ -251282,21 +251282,26 @@ var CliCore = class {
251282
251282
  this.spinner.stop();
251283
251283
  return report;
251284
251284
  }
251285
- await logger.finish();
251286
- if (this.socketLogServer) {
251287
- await this.socketLogServer.close();
251288
- }
251285
+ await this.cleanupLogging();
251289
251286
  } catch (e) {
251290
251287
  await this.spinner.fail();
251291
251288
  logger.error("CLI failed with error:", e);
251292
251289
  await this.shareErrorLogWithBackend(e, true, "cli-error");
251293
- await logger.finish();
251294
- if (this.socketLogServer) {
251295
- await this.socketLogServer.close();
251296
- }
251290
+ await this.cleanupLogging();
251297
251291
  process.exit(1);
251298
251292
  }
251299
251293
  }
251294
+ /**
251295
+ * Clean up logging infrastructure in the correct order:
251296
+ * 1. Close socket server first to ensure all logs are forwarded to the batched HTTP streamer
251297
+ * 2. Then finish logger which flushes the batched HTTP streamer to the backend
251298
+ */
251299
+ async cleanupLogging() {
251300
+ if (this.socketLogServer) {
251301
+ await this.socketLogServer.close();
251302
+ }
251303
+ await logger.finish();
251304
+ }
251300
251305
  async computeAndOutputReportSocketMode(otherModulesCommunicator) {
251301
251306
  logger.info("Fetching artifacts from Socket backend");
251302
251307
  this.sendProgress("SCAN_FOR_VULNERABILITIES", true, ".", ".");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.128",
3
+ "version": "14.12.129",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -76315,7 +76315,11 @@ var SocketTransport = class extends import_winston_transport.default {
76315
76315
  this.connect();
76316
76316
  }
76317
76317
  connect() {
76318
+ if (this.socket) {
76319
+ this.socket.destroy();
76320
+ }
76318
76321
  this.socket = new Socket();
76322
+ this.socket.unref();
76319
76323
  this.socket.on("connect", () => {
76320
76324
  this.connected = true;
76321
76325
  const handshake = {
@@ -76341,10 +76345,11 @@ var SocketTransport = class extends import_winston_transport.default {
76341
76345
  if (this.reconnectTimer) return;
76342
76346
  this.reconnectTimer = setTimeout(() => {
76343
76347
  this.reconnectTimer = null;
76344
- if (!this.connected && this.socket) {
76348
+ if (!this.connected) {
76345
76349
  this.connect();
76346
76350
  }
76347
76351
  }, 1e3);
76352
+ this.reconnectTimer.unref();
76348
76353
  }
76349
76354
  sendMessage(message) {
76350
76355
  if (!this.socket || !this.connected) {