Fork me on GitHub
#tools-build
<
2023-01-30
>
jlmr08:01:46

I’m struggling with a build.clj task on Windows. I’m using build/process to start GraalVM’s native-image . It works fine on MacOS and Linux, but on Windows I get:

Execution error (IOException) at java.lang.ProcessImpl/create (ProcessImpl.java:-2).
CreateProcess error=2, The system cannot find the file specified
I’m not familiar with this error. Does this mean that build/process was unable to find native-image? If so, is there the concept of $PATH on Windows and how does tools.build construct a PATH?

borkdude09:01:20

@U56R03VNW On Windows this is called native-image.cmd. If you use https://github.com/babashka/process then it will work automatically without having to change the command name per OS.

borkdude09:01:05

(apply process/shell "native-image" ... args)

jlmr09:01:12

Thanks for the tip! I will try it and see if that solves the problem

borkdude09:01:58

You can also use babashka.fs/which which will search the path for the "executable" and it will return native-image.cmd on Windows. This function is used within babashka.process to solve this problem

borkdude09:01:17

fs also has a windows? function you can use to differentiate

jlmr09:01:32

Using fs/which fixed the problem! Thanks! Now I just have to cleanup all the different debugging statements and outputs I littered all over the script 🧹

🎉 2