Skip to content

Commit 48513a6

Browse files
committed
vjtop,在设置了-n 次数时,如果输出到文件,也采用clean模式
1 parent 9c75f6b commit 48513a6

File tree

1 file changed

+6
-4
lines changed
  • vjtop/src/main/java/com/vip/vjtools/vjtop

1 file changed

+6
-4
lines changed

vjtop/src/main/java/com/vip/vjtools/vjtop/VJTop.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ public static void main(String[] args) {
9292
}
9393

9494
// 5. console/cleanConsole mode start thread to get user input
95-
if (app.maxIterations == -1 && format != OutputFormat.text) {
95+
if (format != OutputFormat.text) {
9696
InteractiveTask task = new InteractiveTask(app);
9797
// 前台运行,接受用户输入时才启动交互进程
9898
if (task.inputEnabled()) {
9999
view.displayCommandHints = true;
100-
Thread interactiveThread = new Thread(task, "InteractiveThread");
101-
interactiveThread.setDaemon(true);
102-
interactiveThread.start();
100+
if (app.maxIterations == -1) {
101+
Thread interactiveThread = new Thread(task, "InteractiveThread");
102+
interactiveThread.setDaemon(true);
103+
interactiveThread.start();
104+
}
103105
} else {
104106
// 后台运行,输出重定向到文件时,转为没有ansi码的干净模式
105107
format = OutputFormat.cleanConsole;

0 commit comments

Comments
 (0)