TimoT
Denoβ€’14mo agoβ€’
5 replies
Timo

deno include and cannot execute file when compiled

async function run() {
  const o = await Deno.readFile(`${import.meta.dirname}/win_clipboard.exe`);
  console.log(o); // <-- Works and outputs the buffer
  const command = new Deno.Command(`${import.meta.dirname}/win_clipboard.exe`, {
    args: ["--read"],
    stdin: "piped",
    stdout: "piped",
  }).spawn(); // <-- Fails here
  const output = await command.output();
  return output;
}


Command to build:
deno compile -A --include ./win_clipboard.exe  --target x86_64-pc-windows-msvc index.ts



Output:

Uint8Array(6656) [
   77,  90, 144,   0,   3,   0,   0,   0,   4,   0,   0,   0,
  255, 255,   0,   0, 184,   0,   0,   0,   0,   0,   0,   0,
   64,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
  128,   0,   0,   0,  14,  31, 186,  14,   0, 180,   9, 205,
   33, 184,   1,  76, 205,  33,  84, 104, 105, 115,  32, 112,
  114, 111, 103, 114,  97, 109,  32,  99,  97, 110, 110, 111,
  116,  32,  98, 101,
  ... 6556 more items
]
ABC:  error: Uncaught (in promise) NotFound: Failed to spawn 'C:\Users\ADMINI~1\AppData\Local\Temp\2\deno-compile-ClipboardShare-App.exe\ClipboardShare-App\win_clipboard.exe': Das System kann den angegebenen Pfad nicht finden. (os error 3): Das System kann den angegebenen Pfad nicht finden. (os error 3): Das System kann den angegebenen Pfad nicht finden. (os error 3)
    at spawnChildInner (ext:runtime/40_process.js:184:17)
    at spawnChild (ext:runtime/40_process.js:208:10)
    at Command.spawn (ext:runtime/40_process.js:483:12)
    at run (file:///C:/Users/ADMINI~1/AppData/Local/Temp/2/deno-compile-ClipboardShare-App.exe/ClipboardShare-App/index.ts:55:6)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async main (file:///C:/Users/ADMINI~1/AppData/Local/Temp/2/deno-compile-ClipboardShare-App.exe/ClipboardShare-App/index.ts:71:18)


Englisch Error: The system cannot find the specified path.
Was this page helpful?