This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

"exec" how to handle errors ?

Old posts that have not been replied to for several years.
Locked
k
k-ma

"exec" how to handle errors ?

Post by k-ma »

Hi!

Ok i try to grep someting from a file using [exec .... ] - If there is a result then it works great. But if the exec fails i get this:
Tcl error [count]: 0
child process exited abnormally
:(

in Tcl help is written:
(about exec)
If standard output has not been redirected then the exec command returns the standard output from the last command in the pipeline. If any of the commands in the pipeline exit abnormally or are killed or suspended, then exec will return an error and the error message will include the pipeline's output followed by error messages describing the abnormal terminations; the errorCode variable will contain additional information about the last abnormal termination encountered. If any of the commands writes to its standard error file and that standard error isn't redirected, then exec will return an error; the error message will include the pipeline's standard output, followed by messages about abnormal terminations (if any), followed by the standard error output.
So now the Big Question is: how do I catch the error and prevent the script from crashing? :o

i tried several things but in basic I want this:
do [exec ...]
if error { do this }
else { do that }

Thx in Advance
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Have a look at this thread
k
k-ma

Post by k-ma »

yay works like a charm..

uhh acually i found the thread with the search function right before I posted .. but i must have kinda overread that part ...

*sigh* :oops:
Locked