[Python-bugs-list] [ python-Bugs-231204 ] fork()/execv() IDE Crash

noreply@sourceforge.net noreply@sourceforge.net
Mon, 10 Dec 2001 06:56:06 -0800


Bugs item #231204, was opened at 2001-02-05 18:35
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=231204&group_id=5470

Category: IDLE
Group: Platform-specific
>Status: Closed
>Resolution: Works For Me
Priority: 3
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: fork()/execv() IDE Crash

Initial Comment:
I'm just learning the fork()/execv() business and i'm sure this code is crappy... but it does crash IDLE on Windows 98
#system test
import os
MyList = ['127.0.0.1']
while 1:
    
    os.execv('C:\Windows\ping', MyList )
    os.fork()


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-10 06:56

Message:
Logged In: YES 
user_id=6380

IMO there's no bug here, just a clueless user.

(1) This works for me; I get a ping usage message.

(2) MyList[0] should be "ping", MyList[1] should be the
address to ping.

(3) There's no os.fork() -- fortunately this never gets
reached.

(4) os.execv() doesn't return, so the loop gets executed a
half time.

----------------------------------------------------------------------

Comment By: Fredrik Lundh (effbot)
Date: 2001-12-10 00:10

Message:
Logged In: YES 
user_id=38376

ponder, ponder...

don't have Win98, and no time to spare.  maybe an 
sys.exitfunc hook could be used to trap this?  or perhaps 
we need a sys.execfunc?

my advice for the time being is "don't do that".

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-02-05 18:51

Message:
Assigned to effbot for pondering.  On Win98SE, the loop isn't needed, and neither is the fork.  os.execv is enough to crash IDLE.  It dies in tk83.dll.  If I do

bin = r'\bin\wc.exe'
os.execv(bin, [bin, bin])

then wc does run to completion, so I imagine Tk is mondo confused about Python going away.

"Nobody", fork doesn't even exist on Windows:

>>> import os
>>> os.fork
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'os' module has no attribute 'fork'
>>>

This is stuff is natural only on Unix systems.  On Windows, play with the os.spawn* functions instead.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-02-05 18:36

Message:
Questions/Comments can be sent to radiohead83@yahoo.com

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=231204&group_id=5470