inno-setup

Can Inno Setup compiler halt upon Exec() preprocessor function failure?


My Inno Setup script runs a batch script while compiling using #expr, like so:

#expr Exec("\build.bat", null, null, 1)

By design, #expr ignores the return value of the Exec() call. This silently discards any errors, which is not desirable in my case.

Can Inno Setup be made to halt compiling upon Exec() failure?


Solution

  • Use #if and #error directives:

    #if Exec("\build.bat", null, null, 1) != 0
        #error The build batch has failed
    #endif