mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
ExecutableRenameAction => throw Exception on error
This commit is contained in:
parent
d442a8de8b
commit
020f045fc1
@ -1,8 +1,7 @@
|
||||
package net.filebot.cli;
|
||||
|
||||
import static net.filebot.Logging.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.filebot.RenameAction;
|
||||
|
||||
@ -16,10 +15,13 @@ public class ExecutableRenameAction implements RenameAction {
|
||||
|
||||
@Override
|
||||
public File rename(File from, File to) throws Exception {
|
||||
Process process = new ProcessBuilder(executable, from.getPath(), to.getPath()).inheritIO().start();
|
||||
ProcessBuilder process = new ProcessBuilder(executable, from.getPath(), to.getPath());
|
||||
process.directory(from.getParentFile());
|
||||
process.inheritIO();
|
||||
|
||||
if (process.waitFor() != 0) {
|
||||
debug.severe(format("[%s] failed with exit code %d", executable, process.exitValue()));
|
||||
int exitCode = process.start().waitFor();
|
||||
if (exitCode != 0) {
|
||||
throw new IOException(String.format("%s failed with exit code %d", process.command(), exitCode));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user