0
的输出。当执行命令(在Linux中):忽略“断管”信号
go run test.go |head
的输出是:
line 0
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
signal: broken pipe
如何防止程序打印信号通知(最后线)?
[顺便说一句:即使2>/dev/null
dosn't工作。可能是输给TTY的最后一行]
你试过'go run test.go 2>/dev/null | head'? – toth
工作!谢谢。 –
我做了'go run test.go | head 2>/dev/null' –