Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

yet another fix to reloader.

git-svn-id: http://evserver.googlecode.com/svn/trunk@93 e9bb6d7e-af12-11dd-bad7-87afd3b02348
  • Loading branch information...
commit bd20703ccc1abd9b78b6dc25aa3895be2b32ecc5 1 parent a0022cd
majek04 authored
Showing with 11 additions and 4 deletions.
  1. +4 −2 evserver/main.py
  2. +3 −1 evserver/reloader.py
  3. +4 −1 evserver/server.py
6 evserver/main.py
View
@@ -231,11 +231,13 @@ def main(args):
reloader.Reloader(die=die)
if not options.statusaddr:
- server.main_loop( [(host, port, application),] )
+ returnvalue = server.main_loop( [(host, port, application),] )
+ sys.exit(returnvalue)
else:
import status
- server.main_loop( [(host, port, application),
+ returnvalue = server.main_loop( [(host, port, application),
(shost, sport, status.wsgi_application)] )
+ sys.exit(returnvalue)
if __name__ == "__main__":
main(sys.argv[1:])
4 evserver/reloader.py
View
@@ -145,6 +145,7 @@ def update(self, timeout):
self.fam.update(timeout)
if self.toreload and self.die:
log.warning("Code has been changed in file %r. Quitting gracefully." % (self.toreload.keys()[0]))
+ server.returnvalue = 0
libevent.event_loopexit(None)
else:
for fname, modules in self.toreload.items():
@@ -192,7 +193,8 @@ def new_import(*args, **kwargs):
if mod and getattr(mod, '__file__', None):
add_file(mod.__file__, mod)
except AttributeError:
- pass
+ if getattr(omod, '__file__', None):
+ add_file(omod.__file__, omod)
return omod
__builtin__.__import__ = new_import
return
5 evserver/server.py
View
@@ -40,6 +40,8 @@ def my_import(name):
+returnvalue = 1 # default return value from the program
+
HTTP_CALLBACK = ctypes.CFUNCTYPE(None, ctypes.POINTER(libevent.evhttp_request), ctypes.c_void_p)
EVENT_CALLBACK = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.c_short, ctypes.c_void_p)
CLOSE_CALLBACK = ctypes.CFUNCTYPE(None, ctypes.POINTER(libevent.evhttp_connection), ctypes.c_void_p)
@@ -314,7 +316,8 @@ def main_loop( bindings ):
libevent.evhttp_free(http)
libevent.event_base_free(base)
- gc.collect()
utils.clear_ref()
+ gc.collect()
+ return returnvalue
Please sign in to comment.
Something went wrong with that request. Please try again.