-
Notifications
You must be signed in to change notification settings - Fork 5
/
DidjvuScript.java
37 lines (31 loc) · 1.07 KB
/
DidjvuScript.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.genericsystem.cv;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DidjvuScript {
private static Logger log = LoggerFactory.getLogger(DidjvuScript.class);
public static final String shellScript = "../gs-cv/didjvu.sh";
public static void main(String[] args) {
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(Paths.get(".", "classes"), Files::isDirectory)) {
for (Path path : directoryStream) {
runDidjvuScript(path.toString());
}
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
public static int runDidjvuScript(String parameter) {
try {
Process process = Runtime.getRuntime().exec(new String[] { shellScript, parameter });
log.debug("Didjvu processing {}.", parameter);
return process.waitFor();
} catch (IOException | InterruptedException e) {
log.warn("Shell script execution failed on {}.", parameter);
return 1;
}
}
}