[Python-bugs-list] [ python-Bugs-231273 ] [windows] os.popen doens't kill subprocess when interrupted
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 04 Jun 2001 13:46:47 -0700
Bugs item #231273, was updated on 2001-02-06 08:43
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=231273&group_id=5470
Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Christophe Gouiran (cgouiran)
Assigned to: Mark Hammond (mhammond)
Summary: [windows] os.popen doens't kill subprocess when interrupted
Initial Comment:
Hi, in the following script I liked to make an interface to the contig program(http://www.sysinternals.com)
As the popen invocation can be a long time process (since it walks recursively trough directories) I press CTRL-C sometimes and the contig continues to run.
I use Python 2.0 (BeOpen version) under WinNT 4.0(SP 4)
Maybe I made a mistake in the following script ?
-------------------------------------------------
#! /usr/bin/env python
import sys;
import os;
import re;
content = ""
mm = re.compile("Processing (.+)?:\nFragments: (\d+)?");
output = os.popen("contig -a -s *.*");
while(1):
line = output.readline();
if line == '':
break
content += line;
status = output.close()
if status:
print("Error contig : "+`status`+"("+os.strerror(status)+")");
sys.exit(12);
print mm.findall(content)
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2001-06-04 13:46
Message:
Logged In: YES
user_id=21627
A patch for this problem is in progress at
https://sourceforge.net/tracker/index.php?func=detail&aid=403743&group_id=5470&atid=305470
I can't see the bug here, though - why *should*
terminating the parent process terminate the child
processes also?
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-02-09 15:50
Message:
Poor Mark. I assign anything with "popen + Windows" to you, because you're the only one who ever makes progress on them <wink>. Offhand, I can't see how Ctrl+C directed at Python *could* interrupt a spawned process.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=231273&group_id=5470