Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
fe70b7cc
Commit
fe70b7cc
authored
Aug 04, 2014
by
Peter van 't Hof
Browse files
getVersion now also use stderr, also log output when version command is failed
parent
54339295
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetCommandLineFunctionTrait.scala
View file @
fe70b7cc
...
...
@@ -83,20 +83,21 @@ trait BiopetCommandLineFunctionTrait extends CommandLineFunction with Configurab
protected
val
versionExitcode
=
List
(
0
)
// Can select multiple
def
getVersion
:
String
=
{
if
(
versionCommand
==
null
||
versionRegex
==
null
)
return
"N/A"
val
buffer
=
new
StringBuffer
()
val
process
=
Process
(
versionCommand
).
run
(
ProcessLogger
(
buffer
append
_
))
val
stdout
=
new
StringBuffer
()
val
stderr
=
new
StringBuffer
()
def
outputLog
=
"\n output log: \n stdout: \n"
+
stdout
.
toString
+
"\n stderr: \n"
+
stderr
.
toString
val
process
=
Process
(
versionCommand
).
run
(
ProcessLogger
(
stdout
append
_
,
stderr
append
_
))
if
(!
versionExitcode
.
contains
(
process
.
exitValue
))
{
logger
.
warn
(
"Version command: '"
+
versionCommand
+
"' give exit code "
+
process
.
exitValue
+
", version not found"
)
logger
.
warn
(
"Version command: '"
+
versionCommand
+
"' give exit code "
+
process
.
exitValue
+
", version not found"
+
outputLog
)
return
"N/A"
}
val
lines
=
versionCommand
lines_!
ProcessLogger
(
buffer
append
_
)
for
(
line
<-
lines
)
{
for
(
line
<-
stdout
.
toString
.
split
(
"\n"
)
++
stderr
.
toString
.
split
(
"\n"
))
{
line
match
{
case
versionRegex
(
m
)
=>
return
m
case
_
=>
}
}
logger
.
warn
(
"Version command: '"
+
versionCommand
+
"' give a exit code "
+
process
.
exitValue
+
" but no version was found, executable
oke?"
)
logger
.
warn
(
"Version command: '"
+
versionCommand
+
"' give a exit code "
+
process
.
exitValue
+
" but no version was found, executable
correct?"
+
outputLog
)
return
"N/A"
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment