【发布时间】:2018-09-18 14:34:17
【问题描述】:
我喜欢在我的日常测试任务中使用 tcltest。但是测试结果我只能在控制台中看到,所以每次测试运行后我需要切换到那个控制台来查找结果。 根据 tcltest 文档,有选项 outputChannel。此选项允许将测试结果重定向到管道或通道,然后显示在我想要的任何地方。 所以我尝试创建这个频道:
set logger [ open "|bash -c \"while true;do sleep 1; while read mess;do debug=\\\"\$debug \n \$mess\\\";done; if \\\[\\\[ \$debug != \\\"\\\" \\\]\\\];then notify-send \$debug; debug=\\\"\\\";fi; done \" " r+]
接下来我像这样配置 tcltest:
configure -singleproc 1 -verbose t -match ** -outputChannel $logger
然后我尝试在我的频道中发送测试消息:
puts $logger "Test message 1st line \n test message 2 line"
此脚本有效,但不显示测试消息,并且通知中没有 tcltest 输出。 如何创建我的记录器频道??
【问题讨论】:
-
部分问题可能是缓冲问题,部分问题可能是该 bash 脚本中的错误。
-
您的问题实际上涉及两个(不一定相关)问题(可能分为两个单独的问题):1)tcltest 报告间接和 2)I/O 粘合。至于 1)另见我的回答,至于 2),@DonalFellows' 将服务。