System details:
Arduino IDE version 2.3.4 (CLI version 1.1.1)
Operating system: Windows 10 Home 22H2 10.0.19045.5247
Board: Arduino UNO
I'm trying to use platform.local.txt to perform a prebuild action. I first tried using echo as shown in the documentation here: arduino cli > pre- and postbuild hooks
I created a new file "AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\platform.local.txt" and added this line:
recipe.hooks.sketch.prebuild.1.pattern=echo foobar
However, I run into the following error.
exec: "echo": executable file not found in %PATH%
Output in Arduino IDE
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6Detecting libraries used...
[...]
Compiling sketch...
echo foobar
exec: "echo": executable file not found in %PATH%Compilation error: exec: "echo": executable file not found in %PATH%
I can "fix" it with:
recipe.hooks.sketch.prebuild.1.pattern=cmd /.k echo foobar
Output in Arduino IDE
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6Detecting libraries used...
[...]
Compiling sketch...
cmd /k echo foobar
foobar
[...]
I don't understand what environment I'm running the prebuild hooks commands from. I read in the documentation that the Arduino IDE is using the Arduino CLI in deamon mode and communicating with it using gRPC calls. I'll admit I don't know how that works, but I think I understand that on a basic level. I assumed that the CLI is then running other processes from within some shell and that "echo" would be a built-in command within that shell.
All of this left me quite confused... Is it just the fact that I'm on windows that the echo command does not work?