How can i catch error message from command line TCL

1.4k views Asked by At

I'm writing script at tcl on ICC and trying to get error message while sending ran to sung-grid.

For example, I have the below line.

sh /usr/bin/xterm -e "cd DM ; mqsub -int -parallel 200 cal -cal -t 200 CAL_header | tee S.log ; touch .S_finished" &

since I don't have 200 free cpu, If i execute this command line at linux shell I'll get the below message: "Your "qrsh" request could not be scheduled, try again later."

How can i catch this error message at ICC with & and the end of the command?

Thanks

2

There are 2 answers

4
JigarGandhi On

Do you mean Synopsys ICCompiler by term ICC?

If there is any error regarding queue for launching the job for any EDA tool kindly prefer, the following way of launching.

{launch command for job (qsub *switches* ) } > & log &

this will eliminate the troubleshooting difficulties. Sorry for posting this question as answer but i am unable to comment

1
Dinesh On

I assume, you are executing the shell command by means of using exec in tcl.

In that case, you could use catch statement to get identify the error message.

if { [catch {exec <your_shell_program_command_here>} result] } {
    puts "Following problem happened : $result"
    exit 1
} 

Syntax :

catch script ?varName?

Quoting the below from the man page

If script raises an error, catch will return a non-zero integer value corresponding to the exceptional return code returned by evaluation of script. Tcl defines the normal return code from script evaluation to be zero (0), or TCL_OK. Tcl also defines four exceptional return codes: 1 (TCL_ERROR), 2 (TCL_RETURN), 3 (TCL_BREAK), and 4 (TCL_CONTINUE). Errors during evaluation of a script are indicated by a return code of TCL_ERROR.