Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ void addFiles(Collection<Path> files) throws ExecException, IOException, Interru
statFollow = file.statIfFound(Symlinks.FOLLOW);
} catch (FileSymlinkLoopException e) {
// Treat a looping symlink as a dangling symlink.
} catch (IOException e) {
// Execute "dir /a " + file and add the output to the exception message.
ProcessBuilder pb =
new ProcessBuilder("cmd.exe", "/c", "dir", "/a", file.getPathString());
pb.redirectErrorStream(true);
Process process = pb.start();
String processOutput = new String(process.getInputStream().readAllBytes());
String message =
String.format(
"Failed to resolve symlink %s. 'dir /a %s' returned: %s",
file, file.getPathString(), processOutput);
throw new IOException(message, e);
}
if (statFollow == null) {
// Symlink uploaded as a symlink. Report it as a file since we don't know any better.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ private Void plantSingleSymlinkForPackage(
}

private static void throwAbruptExitException(Exception e) throws AbruptExitException {
e.printStackTrace();
throw new AbruptExitException(
DetailedExitCode.of(
FailureDetail.newBuilder()
Expand Down
Loading