Skip to content

Commit

Permalink
print job output file path (alibaba#2566)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangJi92 authored Jun 21, 2023
1 parent dbb67b5 commit 0b29b7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
public class RedirectHandler extends PlainTextHandler implements CloseFunction {
private PrintWriter out;

private File file;

public RedirectHandler() {

}
Expand All @@ -34,6 +36,7 @@ public RedirectHandler(String name, boolean append) throws IOException {
parentFile.mkdirs();
}
}
this.file = file;
out = new PrintWriter(new BufferedWriter(new FileWriter(file, append)));
}

Expand All @@ -55,4 +58,8 @@ public void close() {
out.close();
}
}

public String getFilePath() {
return file.getAbsolutePath();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ private Process createCommandProcess(Command command, ListIterator<CliToken> tok
injectHandler(stdoutHandlerChain, pipelineTokens);
if (redirectHandler != null) {
stdoutHandlerChain.add(redirectHandler);
term.write("redirect output file will be: " + redirectHandler.getFilePath()+"\n");
} else {
stdoutHandlerChain.add(new TermHandler(term));
if (GlobalOptions.isSaveResult) {
Expand Down

0 comments on commit 0b29b7d

Please sign in to comment.