为什么“执行”给出“孩子异常退出”在这段代码中?

发布于 2024-11-18 02:33:22 字数 1360 浏览 6 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甜味超标? 2024-11-25 02:33:22

如果命令返回非零或者向 stderr 发送任何内容,exec 将返回错误。在 http 上有关于使用 catchexec 的非常全面的讨论: //wiki.tcl.tk/exec

exec returns an error if the command returns non-zero or if it sends anything to stderr. There's a very thorough discussion of using catch with exec at http://wiki.tcl.tk/exec

却一份温柔 2024-11-25 02:33:22

如果发现任何差异,diff(和comm)将退出非零,因此您可以重定向输出以将它们用作“此更改吗?”测试。对于 Tcl,您需要使用`|| :' 忽略退出状态的习惯用法。

PS“无用的 grep”... sed -n -e '/INTERNAL VERSION: /s//gp'

diff (and comm) 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'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文