@uipath/common 1.202.0-preview.151 → 1.202.0-preview.152

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/index.js CHANGED
@@ -10662,18 +10662,56 @@ function isSyncFlushForced() {
10662
10662
  function isDrainableTelemetryProvider(provider) {
10663
10663
  return "drainPendingEnvelopes" in provider && typeof provider.drainPendingEnvelopes === "function";
10664
10664
  }
10665
- function spawnTelemetrySidecar(entryPath) {
10666
- const child = spawn(process.execPath, [entryPath, TELEMETRY_DRAIN_ARGV], {
10667
- cwd: getFileSystem().env.tmpdir(),
10668
- detached: true,
10665
+ async function spawnTelemetrySidecar(entryPath) {
10666
+ const cwd = getFileSystem().env.tmpdir();
10667
+ const isWindows = process.platform === "win32";
10668
+ const child = isWindows ? spawn(windowsShell(), windowsLauncherArgs(entryPath), {
10669
+ cwd,
10669
10670
  stdio: "ignore",
10670
- windowsHide: true
10671
+ windowsHide: true,
10672
+ windowsVerbatimArguments: true
10673
+ }) : spawn(process.execPath, [entryPath, TELEMETRY_DRAIN_ARGV], {
10674
+ cwd,
10675
+ detached: true,
10676
+ stdio: "ignore"
10671
10677
  });
10672
10678
  child.on("error", (error) => {
10673
10679
  logger.debug(`[Telemetry] sidecar spawn failed (spool kept for a later run): ${error.message}`);
10674
10680
  });
10681
+ if (isWindows) {
10682
+ await waitForWindowsLauncher(child);
10683
+ }
10675
10684
  child.unref();
10676
10685
  }
10686
+ var WINDOWS_LAUNCHER_TIMEOUT_MS = 3000;
10687
+ function waitForWindowsLauncher(child) {
10688
+ return new Promise((resolve2) => {
10689
+ const timer = setTimeout(resolve2, WINDOWS_LAUNCHER_TIMEOUT_MS);
10690
+ timer.unref();
10691
+ const settle = () => {
10692
+ clearTimeout(timer);
10693
+ resolve2();
10694
+ };
10695
+ child.on("exit", settle);
10696
+ child.on("error", settle);
10697
+ });
10698
+ }
10699
+ function windowsShell() {
10700
+ return process.env.ComSpec ?? "cmd.exe";
10701
+ }
10702
+ function windowsLauncherArgs(entryPath) {
10703
+ return [
10704
+ "/d",
10705
+ "/s",
10706
+ "/c",
10707
+ "start",
10708
+ '""',
10709
+ "/b",
10710
+ `"${process.execPath}"`,
10711
+ `"${entryPath}"`,
10712
+ TELEMETRY_DRAIN_ARGV
10713
+ ];
10714
+ }
10677
10715
  async function trySidecarHandoff(provider) {
10678
10716
  const entryPath = getTelemetrySidecarEntry();
10679
10717
  if (entryPath === undefined || isSyncFlushForced() || !isDrainableTelemetryProvider(provider)) {
@@ -10688,7 +10726,7 @@ async function trySidecarHandoff(provider) {
10688
10726
  if (spoolError) {
10689
10727
  logger.debug(`[Telemetry] spool write failed; dropping ${pending.envelopes.length} pending envelope(s): ${spoolError.message}`);
10690
10728
  } else {
10691
- const [spawnError] = catchError(() => spawnTelemetrySidecar(entryPath));
10729
+ const [spawnError] = await catchError(spawnTelemetrySidecar(entryPath));
10692
10730
  if (spawnError) {
10693
10731
  logger.debug(`[Telemetry] sidecar spawn failed; spool will be sent by a future run: ${spawnError.message}`);
10694
10732
  }
@@ -13698,4 +13736,4 @@ export {
13698
13736
  writeTelemetrySpoolFile
13699
13737
  };
13700
13738
 
13701
- //# debugId=0C2EC5E3F8DF6D7564756E2164756E21
13739
+ //# debugId=58E4DC863EA8483464756E2164756E21
@@ -71,7 +71,7 @@ export declare function telemetryInit(options?: TelemetryInitOptions): Promise<v
71
71
  * Deliver all buffered telemetry before the process exits.
72
72
  * Must be awaited on every exit path.
73
73
  *
74
- * Normally hands the buffered envelopes to a detached sidecar process (see
74
+ * Normally hands the buffered envelopes to a background sidecar process (see
75
75
  * {@link trySidecarHandoff}) so the exit is instant. Falls back to the
76
76
  * in-process flush — one ingestion round-trip, capped at
77
77
  * FLUSH_SHUTDOWN_TIMEOUT_MS — when the sidecar handoff isn't available or
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/common",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.0-preview.151",
4
+ "version": "1.202.0-preview.152",
5
5
  "description": "Common infrastructure needed by uip tools.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -75,5 +75,5 @@
75
75
  "mihaigirleanu",
76
76
  "vlad-uipath"
77
77
  ],
78
- "gitHead": "98bbaa985d34352b6fa380561c2f9269832be5e6"
78
+ "gitHead": "33545fee8460014aa77f1bb0f1678885c65a8632"
79
79
  }