Skip to content

Commit

Permalink
handle not existing known_host file in permission check
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalmer committed Jan 20, 2024
1 parent a39afbc commit ee4f492
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -136,6 +137,10 @@ private boolean hasCorrectSSHFileOwnership() throws IOException, CommandExecutio

try {
if (prc.waitFor() != 0) {
String error = new String(prc.getErrorStream().readAllBytes(), StandardCharsets.UTF_8);
if (error.contains("No such file or directory")) {
return true;
}
throw new CommandExecutionException("Error running command: " + cmd, prc);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- handle not existing known_host file in permission check

0 comments on commit ee4f492

Please sign in to comment.