Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit c56e8df

Browse files
committed
Fixed #664: capture and pass through exit code of mlcp, corb, etc
1 parent 353f2ea commit c56e8df

File tree

1 file changed

+55
-11
lines changed

1 file changed

+55
-11
lines changed

deploy/lib/server_config.rb

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,19 @@ def recordloader
12981298

12991299
runme = %Q{java -cp #{recordloader_file}#{path_separator}#{xcc_file}#{path_separator}#{xpp_file} #{prop_string} com.marklogic.ps.RecordLoader}
13001300
logger.info runme
1301-
`#{runme}`
1301+
r = system(runme)
1302+
logger.debug $?
1303+
1304+
if r == nil
1305+
logger.error "Call to RecordLoader failed"
1306+
r = false
1307+
elsif !r
1308+
logger.error "RecordLoader non-zero exit"
1309+
else
1310+
logger.info ""
1311+
end
1312+
1313+
return r
13021314
end
13031315

13041316
def xqsync
@@ -1324,7 +1336,21 @@ def xqsync
13241336

13251337
runme = %Q{java -Xmx2048m -cp #{xqsync_file}#{path_separator}#{xcc_file}#{path_separator}#{xstream_file}#{path_separator}#{xpp_file} -Dfile.encoding=UTF-8 #{prop_string} com.marklogic.ps.xqsync.XQSync}
13261338
logger.info runme
1327-
`#{runme}`
1339+
1340+
# Note: XQSync doesn't seem to exit with non-zero code at failure (yet), putting this in place nonetheless
1341+
r = system(runme)
1342+
logger.debug $?
1343+
1344+
if r == nil
1345+
logger.error "Call to XQSync failed"
1346+
r = false
1347+
elsif !r
1348+
logger.error "XQSync non-zero exit"
1349+
else
1350+
logger.info ""
1351+
end
1352+
1353+
return r
13281354
end
13291355

13301356
def corb
@@ -1386,9 +1412,6 @@ def corb
13861412
end
13871413
end
13881414

1389-
# we have normalized the options, now clear the args
1390-
ARGV.clear
1391-
13921415
# collect options and set as Java system properties switches
13931416
systemProperties = options.delete_if{ |key, value| value.blank? }
13941417
.map{ |key, value| "-D#{key}=\"#{value}\""}
@@ -1406,11 +1429,24 @@ def corb
14061429
# directory, so that the xquery_modules will be visible with the
14071430
# same path that will be used to see it in the modules database.
14081431
Dir.chdir(@properties['ml.xquery.dir']) do
1409-
`#{runme}`
1432+
r = system(runme)
14101433
end
14111434
else
1412-
`#{runme}`
1435+
r = system(runme)
14131436
end
1437+
logger.debug $?
1438+
1439+
if r == nil
1440+
logger.error "Call to Corb failed"
1441+
r = false
1442+
elsif !r
1443+
logger.error "Corb non-zero exit"
1444+
else
1445+
logger.info ""
1446+
end
1447+
1448+
ARGV.clear
1449+
return r
14141450
end
14151451

14161452
def mlcp
@@ -1490,12 +1526,20 @@ def mlcp
14901526
"PATH" => "#{ENV['PATH']};#{mlcp_home}\\bin",
14911527
"HADOOP_HOME" => mlcp_home
14921528
}
1493-
system(env_variables, runme)
1494-
1495-
logger.info ""
1529+
r = system(env_variables, runme)
1530+
logger.debug $?
1531+
1532+
if r == nil
1533+
logger.error "Call to MLCP failed"
1534+
r = false
1535+
elsif !r
1536+
logger.error "MLCP non-zero exit"
1537+
else
1538+
logger.info ""
1539+
end
14961540

14971541
ARGV.clear
1498-
return true
1542+
return r
14991543
end
15001544

15011545
def credentials

0 commit comments

Comments
 (0)