www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - catching access violations of external programs

reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there any way to catch access violations of external programs?

#
# int ret = system("runMe arg1 arg2");
#

The code above returns a defined value if runMe segfaults in a Unix
environment.

This doesn't work under Windows as it produces a pop up notifying the
user of the access violation. Is there any way to disable those pop ups
and guarantee a return to the calling program?

Thomas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCDe2q3w+/yD4P9tIRAkbXAJsFY7/3f1HBCsMkA83h/yWUBhwpnwCbBI+G
3p8vRwskmMoPSlpB7qS30dI=
=47Ro
-----END PGP SIGNATURE-----
Feb 12 2005
parent reply zwang <nehzgnaw gmail.com> writes:
Thomas Kühne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Is there any way to catch access violations of external programs?
 
 #
 # int ret = system("runMe arg1 arg2");
 #
 
 The code above returns a defined value if runMe segfaults in a Unix
 environment.
 
 This doesn't work under Windows as it produces a pop up notifying the
 user of the access violation. Is there any way to disable those pop ups
 and guarantee a return to the calling program?
 
 Thomas
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.0 (MingW32)
 
 iD8DBQFCDe2q3w+/yD4P9tIRAkbXAJsFY7/3f1HBCsMkA83h/yWUBhwpnwCbBI+G
 3p8vRwskmMoPSlpB7qS30dI=
 =47Ro
 -----END PGP SIGNATURE-----

I guess you'll have to call Windows API's like CreateProcess instead of using std.c.process.system directly.
Feb 12 2005
parent =?ISO-8859-1?Q?Thomas_K=FChne?= <thomas-dloop kuehne.THISISSPAM.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

zwang wrote:

| Thomas Kühne wrote:
|
| Is there any way to catch access violations of external programs?
|
| #
| # int ret = system("runMe arg1 arg2");
| #
|
| The code above returns a defined value if runMe segfaults in a Unix
| environment.
|
| This doesn't work under Windows as it produces a pop up notifying the
| user of the access violation. Is there any way to disable those pop ups
| and guarantee a return to the calling program?

| I guess you'll have to call Windows API's like CreateProcess instead of
| using std.c.process.system directly.

I usually try to minimize the use of platform dependent functions...

Thanks,
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCDhwu3w+/yD4P9tIRAoPqAKDDTFC4fhF6LvlbNILwo2SalOpoRgCfQMLF
R6nfx/PcFiCs3Dzlsk6eh08=
=D2G6
-----END PGP SIGNATURE-----
Feb 12 2005