Avoid race condition with Popen.send_signal

Cameron Simpson cs at zip.com.au
Mon Jan 2 20:44:58 EST 2012

On 02Jan2012 20:31, Devin Jeanpierre <jeanpierreda at gmail.com> wrote:
| > I think that catching the exception is probably the most Pythonic way.
| It's the only correct way.

Indeed, but be precise - chek that it _is_ error 3, or more portably,
errno.ESRCH. POSIX probably mandates that that is a 3, but the symbol
should track the local system if it differs. Example:

  import errno
  except OSError, e:
    if e.errno == errno.ESRCH:
      pass      # or maybe an info log message
      raise     # something else wrong - raise exception anyway

Cameron Simpson <cs at zip.com.au> DoD#743

WHAT"S A ""K3WL D00D"" AND WH3R3 CAN 1 G3T S0M3!!!!!!!!!!!????????
        - Darren Embry

More information about the Python-list mailing list