Skip to content

Commit ae30f91

Browse files
1 parent 6eb7ced commit ae30f91

8 files changed

Lines changed: 24 additions & 578 deletions

Source/Polyfill/ChildProcessPolyfill.ts

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ async function invokeTauri<T>(
184184

185185
throw new Error(`Tauri invoke not available for command: ${command}`);
186186
} catch (error: unknown) {
187-
console.error(
188-
`[ChildProcessPolyfill] Tauri invoke failed for ${command}:`,
189-
error,
190-
);
191187
throw error;
192188
}
193189
}
@@ -230,10 +226,6 @@ function listenToTauri(
230226
);
231227
};
232228
}
233-
234-
console.warn(
235-
`[ChildProcessPolyfill] Tauri event listener not available for: ${event}`,
236-
);
237229
return () => {};
238230
}
239231

@@ -249,15 +241,10 @@ function createMockStream(direction: "read" | "write"): Stream {
249241

250242
return {
251243
write(data: string | Buffer): boolean {
252-
console.log(
253-
`[ChildProcessPolyfill] Stream write (${direction}):`,
254-
data.toString().slice(0, 100),
255-
);
256244
return true;
257245
},
258246

259247
end(data?: string | Buffer): void {
260-
console.log(`[ChildProcessPolyfill] Stream end (${direction})`);
261248
this.emit("end");
262249
},
263250

@@ -283,10 +270,6 @@ function createMockStream(direction: "read" | "write"): Stream {
283270
try {
284271
listener(...args);
285272
} catch (error) {
286-
console.error(
287-
`[ChildProcessPolyfill] Stream event error (${event}):`,
288-
error,
289-
);
290273
}
291274
});
292275
}
@@ -339,10 +322,6 @@ class ChildProcess {
339322
const unlistenSpawn = listenToTauri(
340323
`child_process:spawn:${this._sPid}`,
341324
(payload: unknown) => {
342-
console.log(
343-
`[ChildProcessPolyfill] Spawn event for ${this._sPid}:`,
344-
payload,
345-
);
346325
this.emit("spawn");
347326
},
348327
);
@@ -351,10 +330,6 @@ class ChildProcess {
351330
const unlistenExit = listenToTauri(
352331
`child_process:exit:${this._sPid}`,
353332
(payload: unknown) => {
354-
console.log(
355-
`[ChildProcessPolyfill] Exit event for ${this._sPid}:`,
356-
payload,
357-
);
358333
const data = payload as {
359334
exit_code: number;
360335
signal: Signal | null;
@@ -371,10 +346,6 @@ class ChildProcess {
371346
const unlistenError = listenToTauri(
372347
`child_process:error:${this._sPid}`,
373348
(payload: unknown) => {
374-
console.error(
375-
`[ChildProcessPolyfill] Error event for ${this._sPid}:`,
376-
payload,
377-
);
378349
this.emit("error", payload);
379350
},
380351
);
@@ -427,7 +398,6 @@ class ChildProcess {
427398
* Add event listener
428399
*/
429400
on(event: ChildProcessEvent, listener: ChildProcessEventListener): this {
430-
console.log(`[ChildProcessPolyfill] on(${event}) for ${this._sPid}`);
431401
if (!this.listeners.has(event)) {
432402
this.listeners.set(event, new Set());
433403
}
@@ -488,10 +458,6 @@ class ChildProcess {
488458
try {
489459
listener(...args);
490460
} catch (error) {
491-
console.error(
492-
`[ChildProcessPolyfill] Error in ${event} listener:`,
493-
error,
494-
);
495461
}
496462
});
497463

@@ -506,10 +472,6 @@ class ChildProcess {
506472
* Kill the process
507473
*/
508474
kill(signal: Signal = "SIGTERM"): boolean {
509-
console.log(
510-
`[ChildProcessPolyfill] Kill ${this._sPid} with signal: ${signal}`,
511-
);
512-
513475
if (this.killed) {
514476
return true;
515477
}
@@ -521,10 +483,6 @@ class ChildProcess {
521483
spawn_id: this._sPid,
522484
signal,
523485
}).catch((error) => {
524-
console.error(
525-
`[ChildProcessPolyfill] Kill error for ${this._sPid}:`,
526-
error,
527-
);
528486
});
529487

530488
// Note: We don't immediately mark as killed; wait for exit event from Tauri
@@ -539,19 +497,10 @@ class ChildProcess {
539497
sendHandle?: unknown,
540498
options?: { swallowErrors?: boolean },
541499
): boolean {
542-
console.log(
543-
`[ChildProcessPolyfill] Send message to ${this._sPid}:`,
544-
message,
545-
);
546-
547500
invokeTauri("child_process:send", {
548501
spawn_id: this._sPid,
549502
message,
550503
}).catch((error) => {
551-
console.error(
552-
`[ChildProcessPolyfill] Send error for ${this._sPid}:`,
553-
error,
554-
);
555504
});
556505

557506
return true;
@@ -561,7 +510,6 @@ class ChildProcess {
561510
* Disconnect from the process
562511
*/
563512
disconnect(): void {
564-
console.log(`[ChildProcessPolyfill] Disconnect from ${this._sPid}`);
565513
this.removeAllListeners();
566514
this._unlistenFunctions.forEach((unlisten) => unlisten());
567515
this.stdin.end();
@@ -602,9 +550,6 @@ function spawn(
602550
args?: string[],
603551
options?: SpawnOptions,
604552
): ChildProcess {
605-
console.log(
606-
`[ChildProcessPolyfill] spawn: ${command} ${args?.join(" ") ?? ""}`,
607-
);
608553

609554
// Generate unique spawn ID
610555
const spawnId = `spawn_${Date.now()}_${Math.random().toString(36).substring(7)}`;
@@ -627,9 +572,6 @@ function spawn(
627572
.then((result) => {
628573
if (result.success) {
629574
proc.pid = result.pid;
630-
console.log(
631-
`[ChildProcessPolyfill] Process spawned with PID: ${proc.pid}`,
632-
);
633575
proc.emit("spawn");
634576
} else {
635577
proc.emit(
@@ -639,7 +581,6 @@ function spawn(
639581
}
640582
})
641583
.catch((error) => {
642-
console.error("[ChildProcessPolyfill] spawn error:", error);
643584
proc.emit("error", error);
644585
});
645586

@@ -658,8 +599,6 @@ function exec(
658599
options?: ExecOptions,
659600
callback?: (error: Error | null, stdout: string, stderr: string) => void,
660601
): ChildProcess {
661-
console.log(`[ChildProcessPolyfill] exec: ${command}`);
662-
663602
// Generate unique exec ID
664603
const execId = `exec_${Date.now()}_${Math.random().toString(36).substring(7)}`;
665604

@@ -750,8 +689,6 @@ function fork(
750689
args?: string[],
751690
options?: ForkOptions,
752691
): ChildProcess {
753-
console.log(`[ChildProcessPolyfill] fork: ${modulePath}`);
754-
755692
// Generate unique fork ID
756693
const forkId = `fork_${Date.now()}_${Math.random().toString(36).substring(7)}`;
757694

@@ -779,9 +716,6 @@ function fork(
779716
.then((result) => {
780717
if (result.success) {
781718
proc.pid = result.pid;
782-
console.log(
783-
`[ChildProcessPolyfill] Extension host forked with PID: ${proc.pid}`,
784-
);
785719
proc.emit("spawn");
786720
} else {
787721
proc.emit(
@@ -793,7 +727,6 @@ function fork(
793727
}
794728
})
795729
.catch((error) => {
796-
console.error("[ChildProcessPolyfill] fork error:", error);
797730
proc.emit("error", error);
798731
});
799732
} else {
@@ -848,15 +781,9 @@ export function installChildProcessPolyfill(): void {
848781

849782
// Prevent double installation
850783
if ((window as any).__CHILD_PROCESS_POLYFILL_INSTALLED__) {
851-
console.log("[ChildProcessPolyfill] Already installed, skipping");
852784
return;
853785
}
854786
(window as any).__CHILD_PROCESS_POLYFILL_INSTALLED__ = true;
855-
856-
console.log(
857-
"[ChildProcessPolyfill] Installing Node.js child_process module polyfill...",
858-
);
859-
860787
// Attach module to global (for Node.js compatibility)
861788
(window as any).childProcess = childProcess;
862789

@@ -876,10 +803,6 @@ export function installChildProcessPolyfill(): void {
876803
if (typeof (window as any).vscode !== "undefined") {
877804
(window as any).vscode.childProcess = childProcess;
878805
}
879-
880-
console.log(
881-
"[ChildProcessPolyfill] ✓ Node.js child_process module polyfill installed",
882-
);
883806
}
884807

885808
// Get process from global (for exec path, etc.)

0 commit comments

Comments
 (0)