Skip to content

Commit

Permalink
Merge pull request #2263 from pjanouse/JENKINS-34228
Browse files Browse the repository at this point in the history
[JENKINS-34228] Fixed IOException in DeleteBuildsCommand class
  • Loading branch information
daniel-beck committed Apr 22, 2016
2 parents e1dc525 + efc1285 commit ce9de5a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/src/main/java/hudson/cli/DeleteBuildsCommand.java
Expand Up @@ -29,6 +29,7 @@

import java.io.IOException;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.List;

/**
Expand All @@ -54,10 +55,16 @@ protected void printUsageSummary(PrintStream stderr) {
protected int act(List<AbstractBuild<?, ?>> builds) throws IOException {
job.checkPermission(Run.DELETE);

for (AbstractBuild build : builds)
build.delete();
final HashSet<Integer> hsBuilds = new HashSet<Integer>();

stdout.println("Deleted "+builds.size()+" builds");
for (AbstractBuild build : builds) {
if (!hsBuilds.contains(build.number)) {
build.delete();
hsBuilds.add(build.number);
}
}

stdout.println("Deleted "+hsBuilds.size()+" builds");

return 0;
}
Expand Down

0 comments on commit ce9de5a

Please sign in to comment.