Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8113
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; '"""': 0.07; 'bits': 0.07; 'returned.': 0.07; 'subject:process': 0.07; '16-bit': 0.09; '21,': 0.09; 'subprocess': 0.09; 'tuple': 0.09; 'wrappers': 0.09; 'pm,': 0.10; 'this:': 0.10; 'wrote:': 0.14; 'docs,': 0.16; 'low-level': 0.16; 'pid,': 0.16; 'process?': 0.16; 'windows:': 0.16; 'zero);': 0.16; 'cc:addr:python-list': 0.17; 'tue,': 0.17; '(which': 0.20; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'received:209.85.161.46': 0.23; 'received:mail- fx0-f46.google.com': 0.23; 'code': 0.24; 'byte': 0.25; 'function': 0.25; 'preferred': 0.26; 'received:209.85.161': 0.26; 'correct': 0.28; 'message-id:@mail.gmail.com': 0.28; 'process,': 0.29; 'exit': 0.29; 'instead': 0.29; 'bit': 0.30; 'subject:How': 0.30; 'cc:addr:python.org': 0.30; 'module': 0.30; 'rather': 0.34; 'file': 0.34; 'however,': 0.34; 'core': 0.35; 'using': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'case': 0.37; 'signal': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'containing': 0.39; 'number,': 0.39; 'returned': 0.39; 'according': 0.63; 'back': 0.63; 'high': 0.67; 'low': 0.73; '256': 0.84; 'to:addr:rocketmail.com': 0.84; 'killed': 0.91; 'completion': 0.97 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=fyjIm+/7RDrKxYBU10kom4kbwTbY4l8nry/8CdEMb9M=; b=HAOFm8GTiesYVCRic3f60/2MEkD+AC8sVTEtsE8szXUq06qpfbGoGfrm7T/CTMOKgq xJFrzYT0D9Nq1bvxqkZCRC+KixAxwB1Tw1aOhN3ZW8EffVWUVrYgSNiqQZjInBw9CZJw l4Cwsp9/2on/ACwBGpsqlDU7XDQRX4nd5Bvw4= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=oGgPjZ84UIxwgYwa0wUvMdO5WLIQp90q25TjVEct0gs0BWzlDrblWhIcmMdqbsxLOx zQBYE2lpWgpQxV71SrjZ5dfqIbWbjXZS26+wmPerd6LdliEX3q7iOcnLvKDQulxeIxdy XGRgsPwLL3/0m1VWve6O56Z4niKUYQ150f/s0= |
| MIME-Version | 1.0 |
| In-Reply-To | <ae67ad89-86f4-4374-9127-18f0193d23cc@m10g2000yqd.googlegroups.com> |
| References | <ae67ad89-86f4-4374-9127-18f0193d23cc@m10g2000yqd.googlegroups.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 21 Jun 2011 12:54:57 -0600 |
| Subject | Re: How to get return values of a forked process |
| To | Ian <ian.lake@rocketmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.239.1308682529.1164.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308682529 news.xs4all.nl 49179 [::ffff:82.94.164.166]:58403 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8113 |
Show key headers only | View raw
On Tue, Jun 21, 2011 at 12:26 PM, Ian <ian.lake@rocketmail.com> wrote: > myForkedScript has code like this: > if fail: > os._exit(1) > else: > os._exit(os.EX_OK) > > Is using os._exit() the correct way to get a return value back to the > main process? sys.exit() is the preferred way. > I thought the value 'n', passed in os._exit(n) would be the value I > get returned. In the case of a failure, I get 256 returned rather > than 1. According to the docs, on Unix: """ Wait for completion of a child process, and return a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced. """ And on Windows: """ Wait for completion of a process given by process handle pid, and return a tuple containing pid, and its exit status shifted left by 8 bits (shifting makes cross-platform use of the function easier). """ (256 >> 8) == 1 However, I would advise using the subprocess module for this instead of the os module (which is just low-level wrappers around system calls).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to get return values of a forked process Ian <ian.lake@rocketmail.com> - 2011-06-21 11:26 -0700
Re: How to get return values of a forked process Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-21 12:54 -0600
Re: How to get return values of a forked process Ian <ian.lake@rocketmail.com> - 2011-06-21 12:17 -0700
Re: How to get return values of a forked process Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-21 13:31 -0600
Re: How to get return values of a forked process Chris Torek <nospam@torek.net> - 2011-06-21 20:11 +0000
csiph-web