如果我运行以下命令:
chef-client --force-formatter --logfile STDOUT 2>&1
然后 control-c 它在运行中(或遇到任何类型的错误)我看到这个很好的错误消息:
[2014-09-12T00:00:30-04:00] FATAL: SIGINT received, stopping
================================================================================
Recipe Compile Error in /var/cache/chef/cookbooks/users/recipes/fen.rb
================================================================================
SystemExit
----------
exit
Cookbook Trace:
---------------
/var/cache/chef/cookbooks/users/recipes/default.rb:11:in ``'
/var/cache/chef/cookbooks/users/recipes/default.rb:11:in `from_file'
/var/cache/chef/cookbooks/users/recipes/fen.rb:15:in `from_file'
Relevant File Content:
----------------------
/var/cache/chef/cookbooks/users/recipes/default.rb:
etc...
[2014-09-12T00:00:30-04:00] ERROR: Running exception handlers
[2014-09-12T00:00:30-04:00] ERROR: Exception handlers complete
[2014-09-12T00:00:30-04:00] FATAL: Stacktrace dumped to /var/cache/chef/chef-stacktrace.out
Chef Client failed. 0 resources updated
但是,如果我执行以下操作:
chef-client --force-formatter --logfile STDOUT 2>&1 | tee /tmp/chef.log
然后 control-c,我看到了我之前看到的所有日志消息,除了那个很好的致命消息告诉我发生了什么。我正在传输的文件也没有显示致命消息。
所以显然厨师客户端正在检测它是否正在管道到实际的文件描述符,如果是,则抑制输出。有谁知道阻止它这样做的方法?