views:

160

answers:

3

I am calling a command-line program from my Perl script. When these programs crash, I am prompted with a messagebox asking me if I want to notify Microsoft. Since this is an automated system it would be desirable if I could suppress that message and continue with other things in my script. Is this possible?

A: 

The problem doesn't sound like its a Perl problem, it sounds like an issue with the system commands. Which do you mean by "when these programs crash". Your system programs?

It depends on what is causing the crash. This is the "Dr. Watson" error / WinQUAL feature and it really should not happen for pure Perl code, if it does, it means the Perl interpreter is crashing and you have a Perl bug or are using a native extension that is crashing, make sure you have the latest stable build of either Perl or any native extensions. Narrow it down to what is crashing.

You can also turn off the Windows Error Reporting feature altogether, from the Windows control panel.

mrjoltcola
I think Pete means that the program being launched by `system` is crashing, and the `system` call doesn't return until the dialog has been closed. `eval` won't help with that. It wouldn't help with a crashing Perl interpreter either.
cjm
Thanks for the correction. Sorry, I really didn't think about my answer very well and made a dumb assumption without reading the docs.
mrjoltcola
+1  A: 

You probably could use the WerAddExcludedApplication function to stop WER from kicking in when the program crashes. You should revert hat exclusion afterwards again with WerRemoveExcludedApplication.

Joey
Side note: I'm fairly certain there must be a better way. After all, what are you going to do if that's part of an automated background job, or you just have non-graphical shell access from remote? I'm fairly sure there is a *correct* solution to the problem; this is merely a hack around it.
Joey
+1  A: 

A little more info on how to switch off error reporting

justintime