@@ -172,17 +172,17 @@ function readClipboardImageViaPowerShell(): ClipboardImage | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
const psQuotedWinPath = winPath.replaceAll("'", "''");
|
||||
const psScript = [
|
||||
"Add-Type -AssemblyName System.Windows.Forms",
|
||||
"Add-Type -AssemblyName System.Drawing",
|
||||
"$path = $env:PI_WSL_CLIPBOARD_IMAGE_PATH",
|
||||
`$path = '${psQuotedWinPath}'`,
|
||||
"$img = [System.Windows.Forms.Clipboard]::GetImage()",
|
||||
"if ($img) { $img.Save($path, [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'empty' }",
|
||||
].join("; ");
|
||||
|
||||
const result = runCommand("powershell.exe", ["-NoProfile", "-Command", psScript], {
|
||||
timeoutMs: DEFAULT_POWERSHELL_TIMEOUT_MS,
|
||||
env: { ...process.env, PI_WSL_CLIPBOARD_IMAGE_PATH: winPath },
|
||||
});
|
||||
if (!result.ok) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user