Commit Graph

16 Commits

Author SHA1 Message Date
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