DaveTeng0 commented on code in PR #6574:
URL: https://github.com/apache/ozone/pull/6574#discussion_r1597036844


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/OzoneRepair.java:
##########
@@ -61,4 +66,27 @@ public OzoneConfiguration getOzoneConf() {
   public static void main(String[] argv) throws Exception {
     new OzoneRepair().run(argv);
   }
+
+  @Override
+  public int execute(String[] argv) {
+    String currentUser = getSystemUserName();
+    String s = getConsoleReadLineWithFormat(currentUser);
+    boolean shouldProceed = Boolean.parseBoolean(s) || "y".equalsIgnoreCase(s);
+    if (!shouldProceed) {
+      System.out.println("Aborting command.");
+      return 1;
+    }
+    System.out.println("Run as user: " + currentUser);
+
+    return super.execute(argv);
+  }
+
+  public  String getSystemUserName() {
+    return System.getProperty("user.name");
+  }
+
+  public  String getConsoleReadLineWithFormat(String currentUser) {
+    return System.console().readLine(String.format(WARNING_SYS_USER_MESSAGE, 
currentUser));

Review Comment:
   make sense! updated! Thanks @errose28!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to