Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GitWrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Seibt
GitWrapper
Commits
f69f7e91
Commit
f69f7e91
authored
8 years ago
by
Georg Seibt
Browse files
Options
Downloads
Patches
Plain Diff
make the fields in ExecRes final
parent
9a5ada2f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
+18
-9
18 additions, 9 deletions
..._passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
with
18 additions
and
9 deletions
src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
+
18
−
9
View file @
f69f7e91
...
...
@@ -25,10 +25,16 @@ public class ProcessExecutor {
/**
* The result of a process execution.
*/
public
static
class
ExecRes
{
public
int
exitCode
;
public
String
stdOut
;
public
String
stdErr
;
public
static
final
class
ExecRes
{
public
final
int
exitCode
;
public
final
String
stdOut
;
public
final
String
stdErr
;
private
ExecRes
(
int
exitCode
,
String
stdOut
,
String
stdErr
)
{
this
.
exitCode
=
exitCode
;
this
.
stdOut
=
stdOut
;
this
.
stdErr
=
stdErr
;
}
}
/**
...
...
@@ -70,25 +76,28 @@ public class ProcessExecutor {
LOG
.
fine
(()
->
String
.
format
(
"Executing '%s' in '%s'."
,
cmd
,
builder
.
directory
().
getAbsolutePath
()));
try
{
ExecRes
res
=
new
ExecRes
();
Process
p
=
builder
.
start
();
res
.
stdOut
=
IOUtils
.
toString
(
p
.
getInputStream
(),
StandardCharsets
.
UTF_8
).
trim
();
res
.
stdErr
=
IOUtils
.
toString
(
p
.
getErrorStream
(),
StandardCharsets
.
UTF_8
).
trim
();
String
stdOut
=
IOUtils
.
toString
(
p
.
getInputStream
(),
StandardCharsets
.
UTF_8
).
trim
();
String
stdErr
=
IOUtils
.
toString
(
p
.
getErrorStream
(),
StandardCharsets
.
UTF_8
).
trim
();
IOUtils
.
closeQuietly
(
p
.
getInputStream
());
IOUtils
.
closeQuietly
(
p
.
getErrorStream
());
IOUtils
.
closeQuietly
(
p
.
getOutputStream
());
int
exitCode
;
try
{
res
.
exitCode
=
p
.
waitFor
();
exitCode
=
p
.
waitFor
();
}
catch
(
InterruptedException
e
)
{
LOG
.
log
(
WARNING
,
e
,
()
->
String
.
format
(
"Interrupted while waiting for '%s' to finish."
,
cmd
));
p
.
destroyForcibly
();
res
.
exitCode
=
EXIT_FAIL
;
exitCode
=
EXIT_FAIL
;
}
ExecRes
res
=
new
ExecRes
(
exitCode
,
stdOut
,
stdErr
);
LOG
.
fine
(()
->
String
.
format
(
"Execution of '%s' returned exit code %d."
,
cmd
,
res
.
exitCode
));
if
(
res
.
stdOut
.
isEmpty
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment