Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

lib: virgo-init: implement process.exitCode

once and awhile we encounter an error that causes our event loop to exit
before we expect it too. This happened in our scheduler test and
buildbot didn't catch it as an error. So, implement the exitCode logic
that I sent to luvit in virgo:

luvit/luvit#221

I tested this on hash 60ef64f and it
causes make test to exit with a non-zero exit code.
  • Loading branch information...
commit 845a9600c9fb8850d554b646d5a6799ceb53a0d5 1 parent bbc7cd2
Brandon Philips authored
Showing with 6 additions and 1 deletion.
  1. +5 −0 agents/monitoring/tests/init.lua
  2. +1 −1  lib/lua/virgo-init.lua
View
5 agents/monitoring/tests/init.lua
@@ -58,6 +58,10 @@ local function runit(modname, callback)
end
exports.run = function()
+ -- set the exitCode to error in case we trigger some
+ -- bug that causes us to exit the loop early
+ process.exitCode = 1
+
fs.mkdir(tmp_dir, "0755", function()
async.forEachSeries(TESTS_TO_RUN, runit, function(err)
if err then
@@ -68,6 +72,7 @@ exports.run = function()
end)
end
+ process.exitCode = 0
remove_tmp(function()
process.exit(failed)
end)
View
2  lib/lua/virgo-init.lua
@@ -405,7 +405,7 @@ function virgo_init.run(name)
-- Stagents/monitoring/tests/agent-protocol/handshake.hello.response.jsonart the event loop
native.run()
-- trigger exit handlers and exit cleanly
- process.exit(0)
+ process.exit(process.exitCode or 0)
end
return virgo_init
Please sign in to comment.
Something went wrong with that request. Please try again.