diff --git a/src/main/java/hudson/plugins/ws_cleanup/Cleanup.java b/src/main/java/hudson/plugins/ws_cleanup/Cleanup.java index 61a213a..41aeb3d 100644 --- a/src/main/java/hudson/plugins/ws_cleanup/Cleanup.java +++ b/src/main/java/hudson/plugins/ws_cleanup/Cleanup.java @@ -51,7 +51,16 @@ public Object invoke(File f, VirtualChannel channel) throws IOException, Interru if (delete_command != null && patterns == null) { temp_command = delete_command.replaceAll("%s", "\"" + StringEscapeUtils.escapeJava(f.getPath()) + "\""); this.listener.getLogger().println("Using command: " + temp_command); - Process deletion_proc = new ProcessBuilder(temp_command).start(); + List list = new ArrayList(); + + java.util.regex.Pattern p = java.util.regex.Pattern.compile("\"[^\"]+\"|\\S+"); + java.util.regex.Matcher m = p.matcher(temp_command); + + while(m.find()) { + list.add(m.group()); + } + + Process deletion_proc = new ProcessBuilder(list).start(); deletion_proc.waitFor(); return null;