




















11// Guest Transports script supports OpenClaw repository automation.
2+import { randomUUID } from "node:crypto";
23import { run } from "./host-command.ts";
34import type { PhaseRunner } from "./phase-runner.ts";
45import { encodePowerShell, psSingleQuote } from "./powershell.ts";
@@ -24,6 +25,10 @@ export interface WindowsBackgroundPowerShellOptions {
2425vmName: string;
2526}
262728+function guestScriptName(extension: string): string {
29+return `openclaw-parallels-${randomUUID()}.${extension}`;
30+}
31+2732function appendOutput(
2833append: ((chunk: string | Uint8Array) => void) | undefined,
2934result: CommandResult,
@@ -366,7 +371,7 @@ export class LinuxGuest {
366371}
367372368373bash(script: string): string {
369-const scriptPath = `/tmp/openclaw-parallels-${process.pid}-${Date.now()}.sh`;
374+const scriptPath = `/tmp/${guestScriptName("sh")}`;
370375const write = run(
371376"prlctl",
372377[
@@ -450,7 +455,7 @@ export class MacosGuest {
450455}
451456452457sh(script: string, env: Record<string, string> = {}): string {
453-const scriptPath = `/tmp/openclaw-parallels-${process.pid}-${Date.now()}.sh`;
458+const scriptPath = `/tmp/${guestScriptName("sh")}`;
454459this.exec(["/bin/dd", `of=${scriptPath}`, "bs=1048576"], {
455460input: `umask 022\n${script}`,
456461});
@@ -486,7 +491,7 @@ export class WindowsGuest {
486491}
487492488493powershell(script: string, options: GuestExecOptions = {}): string {
489-const scriptName = `openclaw-parallels-${process.pid}-${Date.now()}.ps1`;
494+const scriptName = guestScriptName("ps1");
490495const writeScript = `$scriptPath = Join-Path $env:TEMP ${JSON.stringify(scriptName)}
491496[System.IO.File]::WriteAllText($scriptPath, [Console]::In.ReadToEnd(), [System.Text.UTF8Encoding]::new($false))`;
492497const write = run(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。