Revision 838239fa logic/dispatcher.py

b/logic/dispatcher.py
53 53
                self._init()
54 54

  
55 55
        [self.chan.basic_cancel(clienttag) for clienttag in self.clienttags]
56
        self.chan.close()
57 56
        self.chan.connection.close()
57
        self.chan.close()
58 58
        sys.exit()
59 59

  
60 60
    def _init(self):
......
182 182
    chan.connection.close()
183 183

  
184 184

  
185
def debug_mode(logger):
186
    disp = Dispatcher(debug = True, logger = logger)
187
    signal(SIGINT, _exit_handler)
188
    signal(SIGTERM, _exit_handler)
189

  
190
    disp.wait()
191

  
192

  
185 193
def main():
186 194
    global children, logger
187 195
    (opts, args) = parse_arguments(sys.argv[1:])
......
202 210
        cleanup_queues()
203 211
        return
204 212

  
213
    # Debug mode, process messages without spawning workers
214
    if opts.debug:
215
        debug_mode(logger = logger)
216
        return
217

  
205 218
    # Fork workers
206 219
    children = []
207 220

  
......
228 241
    for pid in children:
229 242
        try:
230 243
            os.waitpid(pid)
231
        except Exception:
232
            pass
244
        except Exception as e:
245
            logger.error("Error waiting for child %d: %s"%(pid, e.message))
246
            raise
233 247

  
234 248

  
235 249
if __name__ == "__main__":

Also available in: Unified diff