|
@@ -444,6 +444,7 @@ public class TopCLI extends YarnCLI {
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
TopCLI topImp = new TopCLI();
|
|
|
+ topImp.addShutdownHook();
|
|
|
topImp.setSysOutPrintStream(System.out);
|
|
|
topImp.setSysErrPrintStream(System.err);
|
|
|
int res = ToolRunner.run(topImp, args);
|
|
@@ -492,7 +493,6 @@ public class TopCLI extends YarnCLI {
|
|
|
rmStartTime = getRMStartTime();
|
|
|
}
|
|
|
}
|
|
|
- clearScreen();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1220,4 +1220,11 @@ public class TopCLI extends YarnCLI {
|
|
|
byte[] output = IOUtils.toByteArray(p.getInputStream());
|
|
|
return new String(output, "ASCII");
|
|
|
}
|
|
|
+
|
|
|
+ private void addShutdownHook() {
|
|
|
+ //clear screen when the program exits
|
|
|
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
|
|
+ clearScreen();
|
|
|
+ }));
|
|
|
+ }
|
|
|
}
|