为什么“执行”给出“孩子异常退出”在这段代码中?
我在 tcl 中运行此代码:-
set version [exec grep "INTERNAL VERSION:" mojave.log | sed -n -e "s/INTERNAL VERSION: //g" > xor.diff]
set p [exec diff ../log.warning.diff ../log.warning.gold >> xor.diff ]
对于最后一行,它在执行一些 diff 后给出以下错误:-
> RULE-311 WARNING: Gdsii layer number 85 datatype 0 has already been defined
> TCL-11 WARNING: Command "check quartz drc" is overridden, Quality Of
> TCL-11 WARNING: Command "delete marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "import marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "mojave! run filter log" is overridden, Quality Of
> TCL-11 WARNING: Command "run quartz gui" is overridden, Quality Of Results
> TCL-11 WARNING: Command "ui! mojave draw rectangle" is overridden, Quality
> TCL-11 WARNING: Command "ui! mojave set_context" is overridden, Quality Of
> TCL-12 WARNING: Overridden command "mojave! run filter log" is used,
child process exited abnormally
while executing
"exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff "
invoked from within
"set p [exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff ]"
(file "test.tcl" line 4)
invoked from within
"source test.tcl"
并且它没有在“xor.diff
”文件中写入任何内容。
I am running this code in tcl:-
set version [exec grep "INTERNAL VERSION:" mojave.log | sed -n -e "s/INTERNAL VERSION: //g" > xor.diff]
set p [exec diff ../log.warning.diff ../log.warning.gold >> xor.diff ]
For the last line it gives the following error after doing some diff:-
> RULE-311 WARNING: Gdsii layer number 85 datatype 0 has already been defined
> TCL-11 WARNING: Command "check quartz drc" is overridden, Quality Of
> TCL-11 WARNING: Command "delete marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "import marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "mojave! run filter log" is overridden, Quality Of
> TCL-11 WARNING: Command "run quartz gui" is overridden, Quality Of Results
> TCL-11 WARNING: Command "ui! mojave draw rectangle" is overridden, Quality
> TCL-11 WARNING: Command "ui! mojave set_context" is overridden, Quality Of
> TCL-12 WARNING: Overridden command "mojave! run filter log" is used,
child process exited abnormally
while executing
"exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff "
invoked from within
"set p [exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff ]"
(file "test.tcl" line 4)
invoked from within
"source test.tcl"
And it is not writing anything in "xor.diff
" file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果命令返回非零或者向 stderr 发送任何内容,
exec
将返回错误。在 http 上有关于使用catch
和exec
的非常全面的讨论: //wiki.tcl.tk/execexec
returns an error if the command returns non-zero or if it sends anything to stderr. There's a very thorough discussion of usingcatch
withexec
at http://wiki.tcl.tk/exec如果发现任何差异,
diff
(和comm
)将退出非零,因此您可以重定向输出以将它们用作“此更改吗?”测试。对于 Tcl,您需要使用`|| :' 忽略退出状态的习惯用法。PS“无用的 grep”...
sed -n -e '/INTERNAL VERSION: /s//gp'
diff
(andcomm
) exits nonzero if any differences are found, so you can redirect the output to use them as "did this change?" tests. For Tcl you'll want to use the `|| :' idiom to ignore the exit status.P.S. "useless use of grep"...
sed -n -e '/INTERNAL VERSION: /s//gp'