Question

I'm using Delphi XE2 and madExcept. I want to run a process after the build finishes, including the madExcept stuff that occurs at the end of the build process.

Putting my batch-file in the post-build events causes my batch-file to run before the madExcept stuff finishes. I thought perhaps I could spawn a detached process using the DOS start command that would pause for a few seconds so the build can finish, then the paused process can do its tasks. I tried the following as the post-build command:

start "" cmd /c "timeout /t 5&RunPostBuild.bat"

However, instead of opening a separate window and continuing the build process, Delphi opens a window, waits the 5 seconds, runs RunPostBuild.bat and then finishes the build process. The result is the same; RunPostBuild.bat still runs before madExcept does its stuff.

Does anyone know how to truly run a process automatically at the end of the build process, including the madExcept stuff?

Was it helpful?

Solution

If you can disable the post-processing that madExcept does in the IDE, you could then add that as part of the post-build operations by running madExceptPatch.exe. The madExcept FAQ suggests using the -gd flag.

OTHER TIPS

There doesn't seem to be a way to do it from the IDE alone. However, if you create a scheduled task to run once, delete the trigger (so just the task remains with no schedule of when to run), then you can add a command to the post-build events to run the task on-demand. Delphi will immediately return and finish the build process even though the task hasn't completed yet.

By putting a timeout /t 5 at the start of the batch file that the scheduled task runs, 5 seconds will elapse while the IDE finishes the build, then the remaining commands in the batch file will execute.

The command to add to the post-build events is:

schtasks /run /tn "Name of scheduled task"

It works very reliably.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top