Added more logging
This commit is contained in:
parent
c230f7f979
commit
9843cfeb6b
2 changed files with 17 additions and 0 deletions
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,6 +76,10 @@ public class ExecOperation extends AbstractOperation<ExecOperation> {
|
||||||
pb.command(args_);
|
pb.command(args_);
|
||||||
pb.directory(workDir);
|
pb.directory(workDir);
|
||||||
|
|
||||||
|
if (LOGGER.isLoggable(Level.INFO)) {
|
||||||
|
LOGGER.info(String.join(" ", args_));
|
||||||
|
}
|
||||||
|
|
||||||
var proc = pb.start();
|
var proc = pb.start();
|
||||||
var err = proc.waitFor(30, TimeUnit.SECONDS);
|
var err = proc.waitFor(30, TimeUnit.SECONDS);
|
||||||
var stdout = readStream(proc.getInputStream());
|
var stdout = readStream(proc.getInputStream());
|
||||||
|
@ -99,6 +104,12 @@ public class ExecOperation extends AbstractOperation<ExecOperation> {
|
||||||
errorMessage.append("STDOUT -> ").append(stdout.get(0));
|
errorMessage.append("STDOUT -> ").append(stdout.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LOGGER.isLoggable(Level.INFO) && errorMessage.isEmpty() && !stdout.isEmpty()) {
|
||||||
|
for (var l : stdout) {
|
||||||
|
LOGGER.info(l);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errorMessage.append("Invalid working directory: ").append(workDir.getCanonicalPath());
|
errorMessage.append("Invalid working directory: ").append(workDir.getCanonicalPath());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue