2013-07-27 62 views
0

我有返回命令调用使用Tcl脚本行我RTL编译器(Cadence的工具)错误的TCL脚本

puts [exec rc -f script.g ] 

我收到错误,如终止子进程。而如果直接写在我的控制台上来调用工具$ -rc -f script.g,它会得到完美的执行。

+0

什么是退出码?这个过程是否写入标准输出? –

+1

什么_exactly_是错误信息? – nurdglaw

+0

编译器工具无法调用并返回错误:子进程中止 –

回答

0

exec返回一个错误状态,如果:

  • 与非零状态exec'ed命令返回
  • 或打印到stderr

做这个

if {[catch {exec rc -f script.g} output] == 0} { 
    # normal exit status 
    puts $output 
} elseif {$errorCode eq NONE} { 
    # normal exit status, but some output to stderr (contained in $output) 
    puts $output 
} else { 
    # some error condition. 
    # see http://wiki.tcl.tk/1039 for ways to handle 
    puts "some error occurred: $errorCode" 
} 
+0

更好的修复方法可能是重定向标准错误。很难说不知道实际的故障模式。 –