Commit Graph

37 Commits

Author SHA1 Message Date
Georg Brandl 4085f1499c Fix check for empty list (vs. None). 2006-07-21 17:36:31 +00:00
Peter Astrand ff355f1ada Applied patch #1506758: Prevent MemoryErrors with large MAXFD. 2006-06-22 20:21:26 +00:00
Georg Brandl cfecd599b6 Guard the _active.remove() call to avoid errors when there is no _active list. 2006-05-25 18:44:09 +00:00
Martin v. Löwis b95caff56c Clarify cases when waitpid might not return self.pid. 2006-03-24 08:26:26 +00:00
Martin v. Löwis 478c82d30f Bug #1183780: Add Popen objects to _active only in __del__.
Cleanup terminated processes as well.
Add cmd attribute to Popen4.
2006-03-24 08:14:54 +00:00
Martin v. Löwis bd8dbab247 Preserve command name, for later printing of active
commands. If there are active commands when the tests
start, fail, printing these commands.
2006-03-23 18:18:35 +00:00
Andrew M. Kuchling bfd7d6a0ea Fix typo 2005-02-10 13:24:50 +00:00
Johannes Gijsbers 9fc9789a0d Document that on Unix, the 'cmd' argument to the os.popen2/3/4 and
popen2.popen2/3/4 functions can be a sequence. All texts are a variation on the
following:

On \UNIX, \var{cmd} may be a sequence, in which case arguments will be passed
directly to the program without shell intervention (as with
\function{os.spawnv()}). If \var{cmd} is a string it will be passed to the shell
(as with \function{os.system()}).
2004-10-11 18:12:20 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Martin v. Löwis f563c8bbac Patch #817329: Use SC_OPEN_MAX to determine MAXFD. Backported to 2.3. 2003-10-06 21:34:33 +00:00
Fred Drake b5aa407196 Use Boolean values for the capturestderr flag. 2003-07-07 21:36:19 +00:00
Guido van Rossum 3800ef7ae2 When a previous call to poll() has already seen the process status,
wait() should not call waitpid() again.

Should be backported to 2.2.4.
2003-06-02 19:12:01 +00:00
Walter Dörwald 65230a2de7 Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)

Do not mention the string module in the rlcompleter docstring.

This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
2002-06-03 15:58:32 +00:00
Skip Montanaro 1c90d7ab3c tighten up except - os.close only raises OSError
see bug 411881
2002-03-24 20:48:26 +00:00
Skip Montanaro 57fd45ea07 back out spurious change from 1.22 2002-03-12 19:48:03 +00:00
Skip Montanaro 59b40c0828 Popen3 and Popen4 should be in __all__ 2002-03-12 19:16:19 +00:00
Andrew MacIntyre 5cef57131f OS/2 EMX port Library and regression test changes:
Lib/
    os.py
    os2emxpath.py   // added - OS/2 EMX specific path manipulation routines
    popen2.py
    site.py
  Lib/test/
    test_fcntl.py
    test_longexp.py
2002-02-24 05:32:32 +00:00
Martin v. Löwis 95b057e3ea Patch #487784: Support Unicode commands in popen3/4 handling on UNIX. 2001-12-02 13:32:15 +00:00
Tim Peters 658cba6706 Whitespace normalization. 2001-02-09 20:06:00 +00:00
Skip Montanaro 352674d01c a few more __all__ lists 2001-02-07 23:14:30 +00:00
Tim Peters d215218178 test_popen2 broke on Windows shortly after 2.0b2 was released. Fixed it. 2000-10-03 23:07:13 +00:00
Fred Drake d75e63a865 popen4(), class Popen4: popen4() support for Unix.
popen2(), popen3():  Reversed order of bufsize and mode parameters to
                     comply with what was here before (Python 1.5.2).

class Popen3:  Factored the __init__() into a more basic initializer and
               a helper method, to allow some re-use by the Popen4 class.
               Use os.dup2() instead of os.dup() to create the proper
               file descriptors in the child process.

This closes SourceForge bug #115330 and partially closes #115353.
2000-09-28 19:07:53 +00:00
Tim Peters 3620857d60 The "more" cmd varies across Windows flavors, sometimes adding stray
newlines at the start or end.  Fiddle test_popen2 and popen2._test() to
tolerate this.  Also change all "assert"s in these tests to raise
explicit exceptions, so that python -O doesn't render them useless.
Also, in case of error, make the msg display the reprs of what we
wrote and what we read, so we can tell exactly why it's failing.
2000-09-01 20:38:55 +00:00
Fred Drake 31f182e830 Added os.popen2() and os.popen3() for non-Windows platforms. 2000-08-28 17:20:05 +00:00
Tim Peters 84f28db66a Changed the popen2.py _test function to use the "more" cmd when
os.name == "nt".  This makes test_popen2 pass under Win98SE.
HOWEVER, the Win98 "more" invents a leading newline out
of thin air, and I'm not sure that the other Windows flavors
of "more" also do that.
So, somebody please try under other Windows flavors!
2000-08-20 05:57:36 +00:00
Jeremy Hylton fb8849c4a5 remove prints of file objects from _test 2000-07-10 14:28:25 +00:00
Fredrik Lundh 9ac81f69b2 - changed the nt.popen2 return values back to
(write, read, ...), based on feedback from GvR.

- added tuple-swapping code to popen2.py

- fixed some runaway indentation in posixmodule.c
2000-07-09 23:35:24 +00:00
Fredrik Lundh bb7eeff44a - added popen.popen2/popen3/popen4 support for
windows.

- added optional mode argument to popen2/popen3
  for unix; if the second argument is an integer,
  it's assumed to be the buffer size.

- changed nt.popen2/popen3/popen4 return values
  to match the popen2 module (stdout first, not
  stdin).
2000-07-09 17:59:32 +00:00
Guido van Rossum 54f22ed30b More trivial comment -> docstring transformations by Ka-Ping Yee,
who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
2000-02-04 15:10:34 +00:00
Guido van Rossum 068d5724d8 Calling _cleanup() does not guarantee that all processes have
terminated; this makes the final assert in the self-test code fail if
the parent runs faster than the children.  Fix this by calling wait()
on the remaining children instead.
1999-04-20 12:27:31 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum da286666b2 Add optional bufsize argument to various calls so we can make the
os.fdopen() calls unbuffered.  I presume that it's enough if we can
make all three of them (for stdin, stdout, and stderr) unbuffered and
don't need to specify different buffer sizes per file -- that would
complicate the interface more than I care for.
1997-09-29 04:04:39 +00:00
Guido van Rossum 6dd4868681 The command can now either be a string (as before) or a list of
arguments for execvp (for those who don't want the shell's argument
parsing).
1997-09-18 20:00:39 +00:00
Guido van Rossum 0357d02eab Rewrite using class, to make waiting for processes possible;
by default children are waited for automatically.
1997-08-11 03:27:24 +00:00
Guido van Rossum caa9f234bc Change inspired by Tommy Burnette to add an interface to get stderr, too. 1997-04-21 14:15:55 +00:00
Guido van Rossum 971ee13835 pass the command to sh -c 1995-08-07 20:17:23 +00:00
Guido van Rossum 9a22de101f new files 1995-01-12 12:29:47 +00:00