Skip to content

Commit

Permalink
fix: complete results future of selectedFiles
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jan 6, 2023
1 parent 858436b commit a8e29b7
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import lombok.Getter;
import lombok.SneakyThrows;

Expand All @@ -55,7 +56,7 @@ public Selection(File basedir, String[] included, String[] excluded, boolean use
@SneakyThrows
public String[] getSelectedFiles() {
if (selectedFiles.isDone()) {
return selectedFiles.getNow(new String[0]);
return selectedFiles.get(0, TimeUnit.SECONDS);
}

final Path basePath = basedir.toPath();
Expand Down Expand Up @@ -93,7 +94,9 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
return FileVisitResult.CONTINUE;
}
});
return results.toArray(String[]::new);

this.selectedFiles.complete(results.toArray(String[]::new));
return selectedFiles.get(0, TimeUnit.SECONDS);
}

private static String[] buildExclusions(boolean useDefaultExcludes, String[] excludes, String[] overrides) {
Expand Down

0 comments on commit a8e29b7

Please sign in to comment.