Commits

garyvdm committed a5049b0

If running serve with --reload, continue to reload if a SyntaxError is encontered on load.

Comments (0)

Files changed (1)

paste/script/serve.py

 import errno
 import sys
 import time
+import traceback
 try:
     import subprocess
 except ImportError:
 import logging
 import ConfigParser
 
+
 MAXFD = 1024
 
 jython = sys.platform.startswith('java')
             log_fn = os.path.join(base, log_fn)
             self.logging_file_config(log_fn)
 
-        server = self.loadserver(server_spec, name=server_name,
-                                 relative_to=base, global_conf=vars)
-        app = self.loadapp(app_spec, name=app_name,
-                           relative_to=base, global_conf=vars)
+        try:
+            server = self.loadserver(server_spec, name=server_name,
+                                     relative_to=base, global_conf=vars)
+            app = self.loadapp(app_spec, name=app_name,
+                               relative_to=base, global_conf=vars)
+        except SyntaxError, e:
+            if self.options.reload and os.environ.get(self._reloader_environ_key):
+                traceback.print_exc()
+                reloader.watch_file(e.filename)
+                while True:
+                    time.sleep(60*60)
+            else:
+                raise
 
         if self.verbose > 0:
             if hasattr(os, 'getpid'):
                         os.kill(proc.pid, signal.SIGTERM)
                     except (OSError, IOError):
                         pass
-
+            print exit_code
             if reloader:
                 # Reloader always exits with code 3; but if we are
                 # a monitor, any exit code will restart
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.