Skip to content

Commit

Permalink
luvit: add process.exitCode
Browse files Browse the repository at this point in the history
It has happened a few times that the luvit event loop has exited before
we expected in our application due to bugs in luvit. It would be great
to be able to set the exitCode so that if we exit the loop before our
application expects it we can have a failing exit code.

Example usage:
    -- exit luvit with exit code 3 in the event of a pre-mature
    -- event loop exit
    process.exitCode = 3
  • Loading branch information
Brandon Philips committed May 14, 2012
1 parent 3fad442 commit f2d1ae8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/exit-code.lua
@@ -0,0 +1,3 @@
-- exit luvit with exit code 3 in the event of a pre-mature
-- event loop exit
process.exitCode = 3
2 changes: 1 addition & 1 deletion lib/luvit/luvit.lua
Expand Up @@ -313,4 +313,4 @@ end, traceback))
-- Start the event loop
native.run()
-- trigger exit handlers and exit cleanly
process.exit(0)
process.exit(process.exitCode or 0)

0 comments on commit f2d1ae8

Please sign in to comment.