[Python-bugs-list] [Bug #131273] [windows] os.popen doens't kill subprocess when interrupted

noreply@sourceforge.net noreply@sourceforge.net
Fri, 09 Feb 2001 15:50:24 -0800


Bug #131273, was updated on 2001-Feb-06 08:43
Here is a current snapshot of the bug.

Project: Python
Category: Windows
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 5
Submitted by: cgouiran
Assigned to : mhammond
Summary: [windows] os.popen doens't kill subprocess when interrupted

Details: 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)

Follow-Ups:

Date: 2001-Feb-09 15:50
By: tim_one

Comment:
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.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=131273&group_id=5470