Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'completeness': 0.05; 'exit': 0.07; 'layers': 0.07; 'terminated': 0.07; 'byte,': 0.09; 'received:internal': 0.09; 'terminates': 0.09; 'subject:error': 0.11; 'encoding': 0.15; 'value.': 0.15; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'statuses': 0.16; 'alternate': 0.18; 'typical': 0.18; 'versions': 0.20; 'windows': 0.20; 'appears': 0.23; 'header:In-Reply-To:1': 0.24; 'second': 0.24; 'compatible': 0.27; 'plain': 0.27; 'raw': 0.27; 'command': 0.28; '32-bit': 0.29; 'function': 0.30; 'values': 0.30; 'returned': 0.32; 'another': 0.34; 'google': 0.34; 'to:addr :python-list': 0.35; 'represent': 0.35; 'but': 0.36; 'being': 0.36; 'two': 0.37; 'received:10': 0.37; 'subject:: ': 0.37; 'rather': 0.38; 'received:66': 0.38; 'supports': 0.38; 'to:addr:python.org': 0.39; 'some': 0.40; 'from:no real name:2**0': 0.61; 'header:Message-Id:1': 0.62; 'information': 0.62; 'respectively': 0.84; 'different.': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=iOsidg56Cnay/WPIl0PoHRfRtT0=; b=WOzQ3P 9j91wBWPbmUEQEfwXigrUZKA7S0/XYHpsocLAB3zH1Mf0ZXrG3EaJFfUEDqwLVMh vG/3bwBQDDTOr9QMYPopc4Z0kMzguvL5i9M4Utm/ZreUj/dDzBN17FufXuIFdRj7 1iiLcGt+f+rOqL4Cbx/nrAuLyBg3hj1A3RAuE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=iOsidg56Cnay/WP Il0PoHRfRtT0=; b=DXNNbfZuNmmIeg9eNeU0SSoe2LeMwqjR0e1Im7Kop8IzN24 /bQJk9ysraKuoaqT/e9umBs2F2kMf1JH5L9rmS6+PIvWynGBsWNIn0BgyC8pIvCc 7c6giAQTlorcMpoyNO5mRot6ClVLyhhh3naQ4Kca+Rs5djFp1zTnx17VpYrA= X-Sasl-Enc: YN4G5+FmAl+NUADWjkXvY6G2A2Bx6vV29GotkSvcF6+W 1434120396 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-ff004c4b In-Reply-To: <1434119128.1233979.293924985.63E81914@webmail.messagingengine.com> References: <2ebdfdf225c075b2f5ef350b06bc14f0@myglnc.com> <1434119128.1233979.293924985.63E81914@webmail.messagingengine.com> Subject: Re: os.system error returns Date: Fri, 12 Jun 2015 10:46:36 -0400 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1434120398 news.xs4all.nl 2921 [2001:888:2000:d::a6]:53074 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4980 X-Received-Body-CRC: 2590023862 Xref: csiph.com comp.lang.python:92529 For completeness I will note that Windows is completely different. The plain exit status (1 for typical command failures) appears in the os.system result rather than a wait-encoded value. And, incidentally, an MSVC program which calls abort() will return an exit status of 3. A process that terminates another process with TerminateProcess can set that process's exit status to an arbitrary 32-bit value. The MSVC exit function limits the value to one byte, but the raw ExitProcess system call supports any 32-bit value. And, just for fun, two versions of "cat" on my system (one supplied with Git, and one from gnuwin32) return 0x10200 and 0xC000013A respectively when terminated by Ctrl-C. I think the first is some effort at an alternate encoding that's compatible with plain exit statuses in the low-order byte, and the second is the value of STATUS_CONTROL_C_EXIT (an HRESULT). I found some information on google suggesting that some unix-alike layers use an exit status of 0xC00002NN to represent signals (with, once again, plain exit status being a value of 0x00NN). All of these values are available as the returned value from os.system.