0
votes

I am using an outside script from tcl. The script gives its result as a print out to stdout, so I use the command

set scriptRes [exec ${dir}/bin/script $obm_file]

$obm_file is an arguments for the script, the name of the input file for it.

In some cases the input file is not perfect, so the script will give good output and then will give an error, it prints the error message to stderr. Is there a way to tell tcl to take only the "good" output, i.e. the output that went to stdout, and disregard the error message?

1

1 Answers

3
votes

The -ignorestderr option is what you need:

set scriptRes [exec -ignorestderr ${dir}/bin/script $obm_file]

Failing that (e.g., if your Tcl version is too old) use:

set scriptRes [exec ${dir}/bin/script $obm_file 2> /dev/null]