Diff of /build/temp/test_subprocess.py [r4666] .. [r4667] Maximize Restore

  Switch to side-by-side view

--- a/build/temp/test_subprocess.py
+++ b/build/temp/test_subprocess.py
@@ -1,1647 +1,578 @@
-
-
-
-
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
-"http://www.w3.org/TR/REC-html40/loose.dtd">
-<!-- ViewCVS - http://viewcvs.sourceforge.net/
-by Greg Stein - mailto:gstein@lyra.org -->
-<html>
-<head>
-<title>CVS Repository @ Lysator ACS - log - python-popen5: popen5/test_subprocess.py</title>
-<meta name="generator" content="ViewCVS 1.0-dev">
-<link rel="stylesheet" href="/doc/viewcvs/styles.css" type="text/css">
-</head>
-<body>
-<div class="vc_navheader">
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr>
-<td align="left"><a href="/viewcvs/viewcvs.cgi/?root=python-popen5#dirlist">[python-popen5]</a> / <a href="/viewcvs/viewcvs.cgi/popen5/?root=python-popen5#dirlist">popen5</a> / test_subprocess.py</td>
-<td align="right">
-
-<form method=get action="/viewcvs/viewcvs.cgi/">
-
-<b>Project Root:</b>
-<select name="root" onchange="submit()">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<optgroup label="CVS Repositories"><option>accesslog</option><option>adduser</option><option>aido</option><option>airstrike</option><option>anders</option><option>aphoto</option><option>aquamarijn</option><option>BaraKOM</option><option>blasweb</option><option>bokk</option><option>bunker</option><option>bygg</option><option>c1a-google</option><option>chimera</option><option>cyclades-serial-client</option><option>cydpkgadmin</option><option>doris</option><option>DummyProject</option><option>ekalk</option><option>fufreg</option><option>giles</option><option>gpg-pathfinder</option><option>gpgutils</option><option>groundmotion</option><option>gtp</option><option>hiveconf</option><option>isoonline</option><option>kmm-thomas</option><option>kom++</option><option>Kom.pm</option><option>KomSharp</option><option>llost</option><option>lsh</option><option>lubic</option><option>LysAdm</option><option>lyscvs</option><option>LysInv</option><option>lyskom-elisp-client</option><option>lysldap</option><option>lyspython</option><option>mailconf</option><option>mailman-discard</option><option>manikin</option><option>mattricks</option><option>mdh-cd5040-msn02003</option><option>mdi</option><option>medreg</option><option>mojawi</option><option>momr</option><option>mpi</option><option>mta-hashcash</option><option>nemu</option><option>netlogon</option><option>netscape-remote</option><option>nsclient</option><option>nsokoban</option><option>Odd</option><option>oru-community</option><option>oru-obp012-kylsim</option><option>pcl-expect</option><option>perlkom</option><option>photofokus</option><option>PICNIC</option><option>pk</option><option>pkgadmin</option><option>playd</option><option>pum6_test</option><option>pumatta</option><option>pynfs</option><option>pyobfuscate</option><option>python-lyskom</option><option>python-nettle</option><option selected>python-popen5</option><option>python-webmin</option><option>rdesktop</option><option>resourcebooking</option><option>rpm2sysvpkg</option><option>sercd</option><option>sesam1</option><option>snake-farm</option><option>snrgl</option><option>spexdb</option><option>svartvattnet</option><option>swift</option><option>tddc03</option><option>team</option><option>televinken</option><option>tightrealvnc</option><option>tokid</option><option>TSBK</option><option>unfs3</option><option>unilang3</option><option>webkom</option><option>xenofarm</option><option>xmlrpc-c</option><option>xtelevisa</option><option>YASC</option><option>yprolog</option><option>zerofps-data</option></optgroup>
-
-
-<optgroup label="Subversion Repositories"><option>svn</option></optgroup>
-
-</select>
-<input type=submit value="Go">
-</form>
-
-</td>
-</tr>
-</table>
-</div>
-<h1>python-popen5: popen5/test_subprocess.py</h1>
-
-<hr noshade>
-
-Default branch: MAIN
-<br>
-Bookmark a link to HEAD:
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&root=python-popen5">as text</a>)
-
-<br>
-
-
-
- 
-
-
-
-<hr size=1 noshade>
-
-
-<a name="rev1.12"></a>
-<a name="HEAD"></a>
-
-
-Revision <b>1.12</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.12&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.12&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.12&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.12&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Sat Jan  1 09:41:03 2005 UTC</i> (3 years, 5 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-<br>CVS Tags:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=HEAD"><b>HEAD</b></a>
-
-
-
-
-
-
-<br>Changes since <b>1.11: +35 -2 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.11&r2=1.12">previous 1.11</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Synced with Python CVS
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.11"></a>
-
-
-Revision <b>1.11</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.11&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.11&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.11&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.11&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.11&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Thu Oct 21 19:30:18 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.10: +0 -10 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.10&r2=1.11">previous 1.10</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Synched with Python CVS
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.10"></a>
-
-
-Revision <b>1.10</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.10&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.10&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.10&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.10&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.10&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Sun Oct 17 19:20:56 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.9: +5 -5 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.9&r2=1.10">previous 1.9</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Synched with Python CVS
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.9"></a>
-
-
-Revision <b>1.9</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.9&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.9&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.9&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.9&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.9&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Wed Oct 13 07:20:09 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.8: +161 -120 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.8&r2=1.9">previous 1.8</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Synchronized with Python CVS.
-Mainly cosmetic fixes.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.8"></a>
-
-
-Revision <b>1.8</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.8&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.8&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.8&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.8&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.8&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Tue Oct 12 06:56:46 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.7: +6 -6 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.7&r2=1.8">previous 1.7</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Made list2cmdline a module-level function instead of a static method
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.7"></a>
-
-
-Revision <b>1.7</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.7&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.7&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.7&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.7&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.7&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Tue Oct 12 06:39:59 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.6: +0 -15 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.6&r2=1.7">previous 1.6</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Removed the syntactic sugar callv()
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.6"></a>
-
-
-Revision <b>1.6</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.6&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.6&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.6&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.6&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.6&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Tue Oct 12 06:24:48 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.5: +22 -4 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.5&r2=1.6">previous 1.5</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Added test cases for shell=True, and args is a string.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.5"></a>
-
-
-Revision <b>1.5</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.5&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.5&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.5&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.5&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.5&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Mon Oct 11 20:38:25 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.4: +31 -25 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.4&r2=1.5">previous 1.4</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Removed cmdline2list altogether. If passing a string on UNIX, and shell is false, the string will be treated as a sequence with the string as the only item.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.4"></a>
-
-
-Revision <b>1.4</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.4&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.4&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.4&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.4&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.4&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Wed Oct  6 07:33:50 2004 UTC</i> (3 years, 7 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.3: +2 -1 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.3&r2=1.4">previous 1.3</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">When testing creationflags, execute sys.executable instead of cmd.
-cmd doesn't exist on Windows 9X.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.3"></a>
-
-
-Revision <b>1.3</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.3&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.3&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.3&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.3&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.3&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Sun Oct  3 21:18:21 2004 UTC</i> (3 years, 8 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.2: +12 -1 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.2&r2=1.3">previous 1.2</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Implemented test_shell for Windows.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.2"></a>
-
-
-Revision <b>1.2</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.2&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.2&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.2&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.2&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.2&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Sun Oct  3 20:16:18 2004 UTC</i> (3 years, 8 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-<br>Changes since <b>1.1: +3 -2 lines</b>
-
-
-
-
-
-
-
-<br>Diff to <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&r1=1.1&r2=1.2">previous 1.1</a>
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Modified test_shell: No need to use preexec function.
-</pre>
-
-<hr size=1 noshade>
-
-
-<a name="rev1.1"></a>
-
-
-Revision <b>1.1</b>
- -
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.1&root=python-popen5&view=markup">view</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?rev=1.1&root=python-popen5">download</a>)
-(<a href="/viewcvs/viewcvs.cgi/*checkout*/popen5/test_subprocess.py?content-type=text%2Fplain&rev=1.1&root=python-popen5">as text</a>)
-
-(<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?annotate=1.1&root=python-popen5">annotate</a>)
-
-
-- <a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?rev=1.12&root=python-popen5&r1=1.1&view=log">[select for diffs]</a>
-
-
-
-
-<br>
-
-<i>Tue Sep 21 03:27:30 2004 UTC</i> (3 years, 8 months ago) by <i>astrand</i>
-
-<br>Branch:
-
-<a href="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py?root=python-popen5&only_with_tag=MAIN"><b>MAIN</b></a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<pre class="vc_log">Module name changed to subprocess.py
-</pre>
-
- 
-
-
-
-<a name="diff"></a>
-<hr noshade>
-This form allows you to request diffs between any two revisions of
-a file. You may select a symbolic revision name using the selection
-box or you may type in a numeric name using the type-in text box.
-<p>
-<form method="get" action="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py" name="diff_select">
-<input type="hidden" name="root" value="python-popen5" />
-<table border="0" cellpadding="2" cellspacing="0">
-<tr>
-<td>&nbsp;</td>
-<td>
-Diffs between
-
-<select name="r1">
-<option value="text" selected>Use Text Field</option>
-
-<option value="1.12:MAIN">MAIN</option>
-
-<option value="1.12:HEAD">HEAD</option>
-
-</select>
-
-<input type="TEXT" size="12" name="tr1" value="1.1"
-onChange="document.diff_select.r1.selectedIndex=0">
-and
-
-<select name="r2">
-<option value="text" selected>Use Text Field</option>
-
-<option value="1.12:MAIN">MAIN</option>
-
-<option value="1.12:HEAD">HEAD</option>
-
-</select>
-
-<input type="TEXT" size="12" name="tr2" value="1.12"
-onChange="document.diff_select.r1.selectedIndex=0">
-</td>
-</tr>
-<tr>
-<td><input type="checkbox" name="makepatch" id="makepatch" value="1"></td>
-<td><label for="makepatch">Generate output suitable for use with a patch
-program</label></td>
-</tr>
-<tr>
-<td>&nbsp;</td>
-<td>
-Type of Diff should be a
-<select name="diff_format" onchange="submit()">
-<option value="h" selected>Colored Diff</option>
-<option value="l" >Long Colored Diff</option>
-<option value="u" >Unidiff</option>
-<option value="c" >Context Diff</option>
-<option value="s" >Side by Side</option>
-</select>
-<input type="submit" value=" Get Diffs "></form>
-</td>
-</tr>
-</table>
-
-
-
-<hr noshade>
-<a name=branch></a>
-<form method=GET action="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py">
-<input type="hidden" name="root" value="python-popen5" />
-View only Branch:
-<select name="only_with_tag" onchange="submit()">
-<option value="" selected>Show all branches</option>
-
-<option value="MAIN" >MAIN</option>
-
-</select>
-<input type=submit value=" View Branch ">
-</form>
-
-
-<hr noshade>
-<a name=logsort></a>
-<form method=get action="/viewcvs/viewcvs.cgi/popen5/test_subprocess.py">
-<input type="hidden" name="root" value="python-popen5" />
-Sort log by:
-<select name="logsort" onchange="submit()">
-<option value="cvs" >Not sorted</option>
-<option value="date" selected>Commit date</option>
-<option value="rev" >Revision</option>
-</select>
-<input type=submit value=" Sort ">
-</form>
-
-
-<hr noshade>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-<tr>
-<td align="left">
-<address><a href="mailto:lyscvs@lysator.liu.se">Lysator CVS Admin</a></address><br />
-Powered by <a href="http://viewcvs.sourceforge.net/">ViewCVS 1.0-dev</a>
-</td>
-<td align="right">
-<img src="/doc/viewcvs/images/logo.png" alt="(Powered by ViewCVS)" border="0"
-width="128" height="48" /><br />
-<h3><a target="_blank" href="/doc/viewcvs/help_log.html">ViewCVS and CVS Help</a></h3>
-</td>
-</tr>
-</table>
-</body>
-</html>
-
+import unittest
+from test import test_support
+import subprocess
+import sys
+import signal
+import os
+import tempfile
+import time
+import re
+
+mswindows = (sys.platform == "win32")
+
+#
+# Depends on the following external programs: Python
+#
+
+if mswindows:
+    SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), '
+                                                'os.O_BINARY);')
+else:
+    SETBINARY = ''
+
+# In a debug build, stuff like "[6580 refs]" is printed to stderr at
+# shutdown time.  That frustrates tests trying to check stderr produced
+# from a spawned Python process.
+def remove_stderr_debug_decorations(stderr):
+    return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr)
+
+class ProcessTestCase(unittest.TestCase):
+    def mkstemp(self):
+        """wrapper for mkstemp, calling mktemp if mkstemp is not available"""
+        if hasattr(tempfile, "mkstemp"):
+            return tempfile.mkstemp()
+        else:
+            fname = tempfile.mktemp()
+            return os.open(fname, os.O_RDWR|os.O_CREAT), fname
+
+    #
+    # Generic tests
+    #
+    def test_call_seq(self):
+        # call() function with sequence argument
+        rc = subprocess.call([sys.executable, "-c",
+                              "import sys; sys.exit(47)"])
+        self.assertEqual(rc, 47)
+
+    def test_check_call_zero(self):
+        # check_call() function with zero return code
+        rc = subprocess.check_call([sys.executable, "-c",
+                                    "import sys; sys.exit(0)"])
+        self.assertEqual(rc, 0)
+
+    def test_check_call_nonzero(self):
+        # check_call() function with non-zero return code
+        try:
+            subprocess.check_call([sys.executable, "-c",
+                                   "import sys; sys.exit(47)"])
+        except subprocess.CalledProcessError, e:
+            self.assertEqual(e.errno, 47)
+        else:
+            self.fail("Expected CalledProcessError")
+
+    def test_call_kwargs(self):
+        # call() function with keyword args
+        newenv = os.environ.copy()
+        newenv["FRUIT"] = "banana"
+        rc = subprocess.call([sys.executable, "-c",
+                          'import sys, os;' \
+                          'sys.exit(os.getenv("FRUIT")=="banana")'],
+                        env=newenv)
+        self.assertEqual(rc, 1)
+
+    def test_stdin_none(self):
+        # .stdin is None when not redirected
+        p = subprocess.Popen([sys.executable, "-c", 'print "banana"'],
+                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p.wait()
+        self.assertEqual(p.stdin, None)
+
+    def test_stdout_none(self):
+        # .stdout is None when not redirected
+        p = subprocess.Popen([sys.executable, "-c",
+                             'print "    this bit of output is from a '
+                             'test of stdout in a different '
+                             'process ..."'],
+                             stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+        p.wait()
+        self.assertEqual(p.stdout, None)
+
+    def test_stderr_none(self):
+        # .stderr is None when not redirected
+        p = subprocess.Popen([sys.executable, "-c", 'print "banana"'],
+                         stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        p.wait()
+        self.assertEqual(p.stderr, None)
+
+    def test_executable(self):
+        p = subprocess.Popen(["somethingyoudonthave",
+                              "-c", "import sys; sys.exit(47)"],
+                             executable=sys.executable)
+        p.wait()
+        self.assertEqual(p.returncode, 47)
+
+    def test_stdin_pipe(self):
+        # stdin redirection
+        p = subprocess.Popen([sys.executable, "-c",
+                         'import sys; sys.exit(sys.stdin.read() == "pear")'],
+                        stdin=subprocess.PIPE)
+        p.stdin.write("pear")
+        p.stdin.close()
+        p.wait()
+        self.assertEqual(p.returncode, 1)
+
+    def test_stdin_filedes(self):
+        # stdin is set to open file descriptor
+        tf = tempfile.TemporaryFile()
+        d = tf.fileno()
+        os.write(d, "pear")
+        os.lseek(d, 0, 0)
+        p = subprocess.Popen([sys.executable, "-c",
+                         'import sys; sys.exit(sys.stdin.read() == "pear")'],
+                         stdin=d)
+        p.wait()
+        self.assertEqual(p.returncode, 1)
+
+    def test_stdin_fileobj(self):
+        # stdin is set to open file object
+        tf = tempfile.TemporaryFile()
+        tf.write("pear")
+        tf.seek(0)
+        p = subprocess.Popen([sys.executable, "-c",
+                         'import sys; sys.exit(sys.stdin.read() == "pear")'],
+                         stdin=tf)
+        p.wait()
+        self.assertEqual(p.returncode, 1)
+
+    def test_stdout_pipe(self):
+        # stdout redirection
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stdout.write("orange")'],
+                         stdout=subprocess.PIPE)
+        self.assertEqual(p.stdout.read(), "orange")
+
+    def test_stdout_filedes(self):
+        # stdout is set to open file descriptor
+        tf = tempfile.TemporaryFile()
+        d = tf.fileno()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stdout.write("orange")'],
+                         stdout=d)
+        p.wait()
+        os.lseek(d, 0, 0)
+        self.assertEqual(os.read(d, 1024), "orange")
+
+    def test_stdout_fileobj(self):
+        # stdout is set to open file object
+        tf = tempfile.TemporaryFile()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stdout.write("orange")'],
+                         stdout=tf)
+        p.wait()
+        tf.seek(0)
+        self.assertEqual(tf.read(), "orange")
+
+    def test_stderr_pipe(self):
+        # stderr redirection
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stderr.write("strawberry")'],
+                         stderr=subprocess.PIPE)
+        self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()),
+                         "strawberry")
+
+    def test_stderr_filedes(self):
+        # stderr is set to open file descriptor
+        tf = tempfile.TemporaryFile()
+        d = tf.fileno()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stderr.write("strawberry")'],
+                         stderr=d)
+        p.wait()
+        os.lseek(d, 0, 0)
+        self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)),
+                         "strawberry")
+
+    def test_stderr_fileobj(self):
+        # stderr is set to open file object
+        tf = tempfile.TemporaryFile()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys; sys.stderr.write("strawberry")'],
+                         stderr=tf)
+        p.wait()
+        tf.seek(0)
+        self.assertEqual(remove_stderr_debug_decorations(tf.read()),
+                         "strawberry")
+
+    def test_stdout_stderr_pipe(self):
+        # capture stdout and stderr to the same pipe
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys;' \
+                          'sys.stdout.write("apple");' \
+                          'sys.stdout.flush();' \
+                          'sys.stderr.write("orange")'],
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.STDOUT)
+        output = p.stdout.read()
+        stripped = remove_stderr_debug_decorations(output)
+        self.assertEqual(stripped, "appleorange")
+
+    def test_stdout_stderr_file(self):
+        # capture stdout and stderr to the same open file
+        tf = tempfile.TemporaryFile()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys;' \
+                          'sys.stdout.write("apple");' \
+                          'sys.stdout.flush();' \
+                          'sys.stderr.write("orange")'],
+                         stdout=tf,
+                         stderr=tf)
+        p.wait()
+        tf.seek(0)
+        output = tf.read()
+        stripped = remove_stderr_debug_decorations(output)
+        self.assertEqual(stripped, "appleorange")
+
+    def test_cwd(self):
+        tmpdir = os.getenv("TEMP", "/tmp")
+        # We cannot use os.path.realpath to canonicalize the path,
+        # since it doesn't expand Tru64 {memb} strings. See bug 1063571.
+        cwd = os.getcwd()
+        os.chdir(tmpdir)
+        tmpdir = os.getcwd()
+        os.chdir(cwd)
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' \
+                          'sys.stdout.write(os.getcwd())'],
+                         stdout=subprocess.PIPE,
+                         cwd=tmpdir)
+        normcase = os.path.normcase
+        self.assertEqual(normcase(p.stdout.read()), normcase(tmpdir))
+
+    def test_env(self):
+        newenv = os.environ.copy()
+        newenv["FRUIT"] = "orange"
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' \
+                          'sys.stdout.write(os.getenv("FRUIT"))'],
+                         stdout=subprocess.PIPE,
+                         env=newenv)
+        self.assertEqual(p.stdout.read(), "orange")
+
+    def test_communicate(self):
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' \
+                          'sys.stderr.write("pineapple");' \
+                          'sys.stdout.write(sys.stdin.read())'],
+                         stdin=subprocess.PIPE,
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE)
+        (stdout, stderr) = p.communicate("banana")
+        self.assertEqual(stdout, "banana")
+        self.assertEqual(remove_stderr_debug_decorations(stderr),
+                         "pineapple")
+
+    def test_communicate_returns(self):
+        # communicate() should return None if no redirection is active
+        p = subprocess.Popen([sys.executable, "-c",
+                              "import sys; sys.exit(47)"])
+        (stdout, stderr) = p.communicate()
+        self.assertEqual(stdout, None)
+        self.assertEqual(stderr, None)
+
+    def test_communicate_pipe_buf(self):
+        # communicate() with writes larger than pipe_buf
+        # This test will probably deadlock rather than fail, if
+        # communicate() does not work properly.
+        x, y = os.pipe()
+        if mswindows:
+            pipe_buf = 512
+        else:
+            pipe_buf = os.fpathconf(x, "PC_PIPE_BUF")
+        os.close(x)
+        os.close(y)
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;'
+                          'sys.stdout.write(sys.stdin.read(47));' \
+                          'sys.stderr.write("xyz"*%d);' \
+                          'sys.stdout.write(sys.stdin.read())' % pipe_buf],
+                         stdin=subprocess.PIPE,
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE)
+        string_to_write = "abc"*pipe_buf
+        (stdout, stderr) = p.communicate(string_to_write)
+        self.assertEqual(stdout, string_to_write)
+
+    def test_writes_before_communicate(self):
+        # stdin.write before communicate()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' \
+                          'sys.stdout.write(sys.stdin.read())'],
+                         stdin=subprocess.PIPE,
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE)
+        p.stdin.write("banana")
+        (stdout, stderr) = p.communicate("split")
+        self.assertEqual(stdout, "bananasplit")
+        self.assertEqual(remove_stderr_debug_decorations(stderr), "")
+
+    def test_universal_newlines(self):
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' + SETBINARY +
+                          'sys.stdout.write("line1\\n");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line2\\r");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line3\\r\\n");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line4\\r");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("\\nline5");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("\\nline6");'],
+                         stdout=subprocess.PIPE,
+                         universal_newlines=1)
+        stdout = p.stdout.read()
+        if hasattr(open, 'newlines'):
+            # Interpreter with universal newline support
+            self.assertEqual(stdout,
+                             "line1\nline2\nline3\nline4\nline5\nline6")
+        else:
+            # Interpreter without universal newline support
+            self.assertEqual(stdout,
+                             "line1\nline2\rline3\r\nline4\r\nline5\nline6")
+
+    def test_universal_newlines_communicate(self):
+        # universal newlines through communicate()
+        p = subprocess.Popen([sys.executable, "-c",
+                          'import sys,os;' + SETBINARY +
+                          'sys.stdout.write("line1\\n");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line2\\r");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line3\\r\\n");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("line4\\r");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("\\nline5");'
+                          'sys.stdout.flush();'
+                          'sys.stdout.write("\\nline6");'],
+                         stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                         universal_newlines=1)
+        (stdout, stderr) = p.communicate()
+        if hasattr(open, 'newlines'):
+            # Interpreter with universal newline support
+            self.assertEqual(stdout,
+                             "line1\nline2\nline3\nline4\nline5\nline6")
+        else:
+            # Interpreter without universal newline support
+            self.assertEqual(stdout, "line1\nline2\rline3\r\nline4\r\nline5\nline6")
+
+    def test_no_leaking(self):
+        # Make sure we leak no resources
+        max_handles = 1026 # too much for most UNIX systems
+        if mswindows:
+            max_handles = 65 # a full test is too slow on Windows
+        for i in range(max_handles):
+            p = subprocess.Popen([sys.executable, "-c",
+                    "import sys;sys.stdout.write(sys.stdin.read())"],
+                    stdin=subprocess.PIPE,
+                    stdout=subprocess.PIPE,
+                    stderr=subprocess.PIPE)
+            data = p.communicate("lime")[0]
+            self.assertEqual(data, "lime")
+
+
+    def test_list2cmdline(self):
+        self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']),
+                         '"a b c" d e')
+        self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']),
+                         'ab\\"c \\ d')
+        self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']),
+                         'a\\\\\\b "de fg" h')
+        self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']),
+                         'a\\\\\\"b c d')
+        self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']),
+                         '"a\\\\b c" d e')
+        self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']),
+                         '"a\\\\b\\ c" d e')
+
+
+    def test_poll(self):
+        p = subprocess.Popen([sys.executable,
+                          "-c", "import time; time.sleep(1)"])
+        count = 0
+        while p.poll() is None:
+            time.sleep(0.1)
+            count += 1
+        # We expect that the poll loop probably went around about 10 times,
+        # but, based on system scheduling we can't control, it's possible
+        # poll() never returned None.  It "should be" very rare that it
+        # didn't go around at least twice.
+        self.assert_(count >= 2)
+        # Subsequent invocations should just return the returncode
+        self.assertEqual(p.poll(), 0)
+
+
+    def test_wait(self):
+        p = subprocess.Popen([sys.executable,
+                          "-c", "import time; time.sleep(2)"])
+        self.assertEqual(p.wait(), 0)
+        # Subsequent invocations should just return the returncode
+        self.assertEqual(p.wait(), 0)
+
+
+    def test_invalid_bufsize(self):
+        # an invalid type of the bufsize argument should raise
+        # TypeError.
+        try:
+            subprocess.Popen([sys.executable, "-c", "pass"], "orange")
+        except TypeError:
+            pass
+        else:
+            self.fail("Expected TypeError")
+
+    #
+    # POSIX tests
+    #
+    if not mswindows:
+        def test_exceptions(self):
+            # catched & re-raised exceptions
+            try:
+                p = subprocess.Popen([sys.executable, "-c", ""],
+                                 cwd="/this/path/does/not/exist")
+            except OSError, e:
+                # The attribute child_traceback should contain "os.chdir"
+                # somewhere.
+                self.assertNotEqual(e.child_traceback.find("os.chdir"), -1)
+            else:
+                self.fail("Expected OSError")
+
+        def test_run_abort(self):
+            # returncode handles signal termination
+            p = subprocess.Popen([sys.executable,
+                                  "-c", "import os; os.abort()"])
+            p.wait()
+            self.assertEqual(-p.returncode, signal.SIGABRT)
+
+        def test_preexec(self):
+            # preexec function
+            p = subprocess.Popen([sys.executable, "-c",
+                              'import sys,os;' \
+                              'sys.stdout.write(os.getenv("FRUIT"))'],
+                             stdout=subprocess.PIPE,
+                             preexec_fn=lambda: os.putenv("FRUIT", "apple"))
+            self.assertEqual(p.stdout.read(), "apple")
+
+        def test_args_string(self):
+            # args is a string
+            f, fname = self.mkstemp()
+            os.write(f, "#!/bin/sh\n")
+            os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" %
+                        sys.executable)
+            os.close(f)
+            os.chmod(fname, 0700)
+            p = subprocess.Popen(fname)
+            p.wait()
+            os.remove(fname)
+            self.assertEqual(p.returncode, 47)
+
+        def test_invalid_args(self):
+            # invalid arguments should raise ValueError
+            self.assertRaises(ValueError, subprocess.call,
+                              [sys.executable,
+                               "-c", "import sys; sys.exit(47)"],
+                              startupinfo=47)
+            self.assertRaises(ValueError, subprocess.call,
+                              [sys.executable,
+                               "-c", "import sys; sys.exit(47)"],
+                              creationflags=47)
+
+        def test_shell_sequence(self):
+            # Run command through the shell (sequence)
+            newenv = os.environ.copy()
+            newenv["FRUIT"] = "apple"
+            p = subprocess.Popen(["echo $FRUIT"], shell=1,
+                                 stdout=subprocess.PIPE,
+                                 env=newenv)
+            self.assertEqual(p.stdout.read().strip(), "apple")
+
+        def test_shell_string(self):
+            # Run command through the shell (string)
+            newenv = os.environ.copy()
+            newenv["FRUIT"] = "apple"
+            p = subprocess.Popen("echo $FRUIT", shell=1,
+                                 stdout=subprocess.PIPE,
+                                 env=newenv)
+            self.assertEqual(p.stdout.read().strip(), "apple")
+
+        def test_call_string(self):
+            # call() function with string argument on UNIX
+            f, fname = self.mkstemp()
+            os.write(f, "#!/bin/sh\n")
+            os.write(f, "exec %s -c 'import sys; sys.exit(47)'\n" %
+                        sys.executable)
+            os.close(f)
+            os.chmod(fname, 0700)
+            rc = subprocess.call(fname)
+            os.remove(fname)
+            self.assertEqual(rc, 47)
+
+
+    #
+    # Windows tests
+    #
+    if mswindows:
+        def test_startupinfo(self):
+            # startupinfo argument
+            # We uses hardcoded constants, because we do not want to
+            # depend on win32all.
+            STARTF_USESHOWWINDOW = 1
+            SW_MAXIMIZE = 3
+            startupinfo = subprocess.STARTUPINFO()
+            startupinfo.dwFlags = STARTF_USESHOWWINDOW
+            startupinfo.wShowWindow = SW_MAXIMIZE
+            # Since Python is a console process, it won't be affected
+            # by wShowWindow, but the argument should be silently
+            # ignored
+            subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
+                        startupinfo=startupinfo)
+
+        def test_creationflags(self):
+            # creationflags argument
+            CREATE_NEW_CONSOLE = 16
+            sys.stderr.write("    a DOS box should flash briefly ...\n")
+            subprocess.call(sys.executable +
+                                ' -c "import time; time.sleep(0.25)"',
+                            creationflags=CREATE_NEW_CONSOLE)
+
+        def test_invalid_args(self):
+            # invalid arguments should raise ValueError
+            self.assertRaises(ValueError, subprocess.call,
+                              [sys.executable,
+                               "-c", "import sys; sys.exit(47)"],
+                              preexec_fn=lambda: 1)
+            self.assertRaises(ValueError, subprocess.call,
+                              [sys.executable,
+                               "-c", "import sys; sys.exit(47)"],
+                              close_fds=True)
+
+        def test_shell_sequence(self):
+            # Run command through the shell (sequence)
+            newenv = os.environ.copy()
+            newenv["FRUIT"] = "physalis"
+            p = subprocess.Popen(["set"], shell=1,
+                                 stdout=subprocess.PIPE,
+                                 env=newenv)
+            self.assertNotEqual(p.stdout.read().find("physalis"), -1)
+
+        def test_shell_string(self):
+            # Run command through the shell (string)
+            newenv = os.environ.copy()
+            newenv["FRUIT"] = "physalis"
+            p = subprocess.Popen("set", shell=1,
+                                 stdout=subprocess.PIPE,
+                                 env=newenv)
+            self.assertNotEqual(p.stdout.read().find("physalis"), -1)
+
+        def test_call_string(self):
+            # call() function with string argument on Windows
+            rc = subprocess.call(sys.executable +
+                                 ' -c "import sys; sys.exit(47)"')
+            self.assertEqual(rc, 47)
+
+
+def test_main():
+    test_support.run_unittest(ProcessTestCase)
+
+if __name__ == "__main__":
+    test_main()