wutils.py
changeset 6275 77f833c7ddae
parent 5975 c85cb9b073a0
child 6624 a071889af159
equal deleted inserted replaced
6274:3e8b3f2306c9 6275:77f833c7ddae
   145             try:
   145             try:
   146                 retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
   146                 retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
   147             except WindowsError, ex:
   147             except WindowsError, ex:
   148                 raise Utils.WafError("Command %s raised exception %s" % (argv, ex))
   148                 raise Utils.WafError("Command %s raised exception %s" % (argv, ex))
   149     if retval:
   149     if retval:
   150         raise Utils.WafError("Command %s exited with code %i" % (argv, retval))
   150         signame = None
       
   151         if retval < 0: # signal?
       
   152             import signal
       
   153             for name, val in vars(signal).iteritems():
       
   154                 if len(name) > 3 and name[:3] == 'SIG' and name[3] != '_':
       
   155                     if val == -retval:
       
   156                         signame = name
       
   157                         break
       
   158         if signame:
       
   159             raise Utils.WafError("Command %s terminated with signal %s."
       
   160                                  " Run it under a debugger to get more information "
       
   161                                  "(./waf --run <program> --command-template=\"gdb --args %%s <args>\")." % (argv, signame))
       
   162         else:
       
   163             raise Utils.WafError("Command %s exited with code %i" % (argv, retval))
   151     return retval
   164     return retval
   152 
   165 
   153 def get_run_program(program_string, command_template=None):
   166 def get_run_program(program_string, command_template=None):
   154     """
   167     """
   155     Return the program name and argv of the process that would be executed by
   168     Return the program name and argv of the process that would be executed by