Skip to content

Commit 3de60d1

Browse files
committed
use if instead &&/||
avoid exit logic bug when "if clause" fail
1 parent 5a50de8 commit 3de60d1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

c

+5-2
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,8 @@ teeAndCopy() {
9797
) > $out
9898
}
9999

100-
[ ${#args[@]} -eq 0 ] && teeAndCopy ||
101-
"${args[@]}" | teeAndCopy
100+
if [ ${#args[@]} -eq 0 ]; then
101+
teeAndCopy
102+
else
103+
"${args[@]}" | teeAndCopy
104+
fi

docs/java.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
用于快速排查`Java``CPU`性能问题(`top us`值过高),自动查出运行的`Java`进程中消耗`CPU`多的线程,并打印出其线程栈,从而确定导致性能问题的方法调用。
3333
目前只支持`Linux`。原因是`Mac``Windows``ps`命令不支持列出线程线程,更多信息参见[#33](https://github.com/oldratlee/useful-scripts/issues/33),欢迎提供解法。
3434

35-
PS,如何操作可以参见[@bluedavy](http://weibo.com/bluedavy)[《分布式Java应用》](https://book.douban.com/subject/4848587/)的【5.1.1 cpu消耗分析】一节,说得很详细:
35+
PS,如何操作可以参见[@bluedavy](http://weibo.com/bluedavy)[《分布式Java应用》](https://book.douban.com/subject/4848587/)的【5.1.1 `CPU`消耗分析】一节,说得很详细:
3636

3737
1. `top`命令找出有问题`Java`进程及线程`id`
3838
1. 开启线程显示模式(`top -H`,或是打开`top`后按`H`

0 commit comments

Comments
 (0)