(script: string)
| 135 | } |
| 136 | |
| 137 | async function scriptFile(script: string): Promise<string> { |
| 138 | const dir = await fs.mkdtemp(path.join(os.tmpdir(), "runtime-node-script-")) |
| 139 | const filePath = path.join(dir, process.platform === "win32" ? "script.ps1" : "script.sh") |
| 140 | await fs.writeFile(filePath, script, "utf8") |
| 141 | await fs.chmod(filePath, 0o700).catch(() => undefined) |
| 142 | return filePath |
| 143 | } |
| 144 | |
| 145 | function scriptCommand(filePath: string): { command: string; args: string[] } { |
| 146 | if (process.platform === "win32") return { command: "powershell.exe", args: ["-ExecutionPolicy", "Bypass", "-File", filePath] } |
no test coverage detected