View Full Version : .BAT in "Execute after" pitfall

30-07-2018, 06:16 AM
I was using .bat / .sh files instead of makefiles since forever.

It turns out, lots of my problems were because [Erroneous statement removed] So, if you, say, set an envvar from inside an if () block it fails silently and without warning!

Cost me tons of headache and pointless debugging due to executables being compiled with wrong keys.

And all that time I was thinking FPC 3.x was glitchy fecal matter! Which is untrue, as it turns out!

Ñuño Martínez
17-08-2018, 11:47 AM
I use GCC make and it works like a charm. Even on Windows seems to work quite well. I know make has a lot of options and stuff, but you can still take a big advantage with basic functionality.

20-08-2018, 07:26 AM
Update: this was not the case. The problem was with .bat language quirk: if you change an environment variable inside an if () block, the value you read back from it won't change until after that if () block.

18-04-2020, 05:15 PM
Update: *both* Lazarus and MSEide use custom built-in .BAT interpreters with limited functionality. They do not allow changing envvars once set! They fail silently at that, no warning.
The only exception as far as I can tell is PATH.