Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
da6e0d78
Commit
da6e0d78
authored
13 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
Add method toStatus().
SVN: 24105
parent
567165bb
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/process/ProcessResult.java
+29
-0
29 additions, 0 deletions
...e/java/ch/systemsx/cisd/common/process/ProcessResult.java
with
29 additions
and
0 deletions
common/source/java/ch/systemsx/cisd/common/process/ProcessResult.java
+
29
−
0
View file @
da6e0d78
...
@@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
...
@@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
import
ch.systemsx.cisd.base.utilities.OSUtilities
;
import
ch.systemsx.cisd.base.utilities.OSUtilities
;
import
ch.systemsx.cisd.common.concurrent.ExecutionResult
;
import
ch.systemsx.cisd.common.concurrent.ExecutionResult
;
import
ch.systemsx.cisd.common.concurrent.ExecutionStatus
;
import
ch.systemsx.cisd.common.concurrent.ExecutionStatus
;
import
ch.systemsx.cisd.common.exceptions.Status
;
/**
/**
* Class that keeps around the result of running an Operating System process.
* Class that keeps around the result of running an Operating System process.
...
@@ -241,6 +242,34 @@ public final class ProcessResult
...
@@ -241,6 +242,34 @@ public final class ProcessResult
return
errorOutput
;
return
errorOutput
;
}
}
/**
* Returns this result as a {@link Status}.
*/
public
Status
toStatus
()
{
if
(
isOK
())
{
return
Status
.
OK
;
}
else
{
if
(
isTimedOut
())
{
return
Status
.
createRetriableError
(
"Process timed out"
);
}
if
(
isInterruped
())
{
return
Status
.
createRetriableError
(
"Process got interrupted"
);
}
if
(
StringUtils
.
isBlank
(
getStartupFailureMessage
())
==
false
)
{
return
Status
.
createError
(
getStartupFailureMessage
());
}
return
Status
.
createError
(
"Exit Value: "
+
getExitValue
()
+
"\n"
+
StringUtils
.
join
(
getErrorOutput
(),
"\n"
));
}
}
/**
/**
* Returns the text output of the process (<code>stdout</code> and <code>stderr</code>). If it
* Returns the text output of the process (<code>stdout</code> and <code>stderr</code>). If it
* not available (see {@link #isOutputAvailable()}, an empty list is returned.
* not available (see {@link #isOutputAvailable()}, an empty list is returned.
...
...
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