./a.out的重定向无法捕捉段错误 [英] redirection of ./a.out is not capturing segmentation fault
本文介绍了./a.out的重定向无法捕捉段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我运行命令
I run the command
./a.out < in &> output.txt
我想要的错误也被放置在 output.txt的
。
该命令的退出
状态为139和终端输出是:
I want the errors also to be placed in output.txt
.
The exit
status of the command was 139 and on terminal its output was:
Segmentation fault (core dumped)
和文件 output.txt的
是空的。
推荐答案
消息分割故障(核心转储)
是的不的从哪里来的程序。
The message Segmentation fault (core dumped)
is not coming from your program.
它是由外壳由它接收的信号的结果而产生。这不是的标准错误的一部分或标准输出的程序的。
It's produced by shell as result of a signal received by it. It's not a part of stderr or stdout of your program.
所以外壳的消息可以被捕获为:
So shell's message can be captured as:
{ ./a.out; } 2> out_err
这篇关于./a.out的重定向无法捕捉段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文