Skip to content

Commit 94fe1b9

Browse files
committedFeb 27, 2017
Add example script to docstring
1 parent 17367e6 commit 94fe1b9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed
 

‎src/twisted/test/test_process.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -2350,8 +2350,25 @@ class Win32CreateProcessFlagsTests(unittest.TestCase):
23502350
def test_flags(self):
23512351
"""
23522352
Verify that the flags passed to win32process.CreateProcess() prevent a
2353-
new console window from being created. See http://tm.tl/5726
2354-
for a script to test this interactively.
2353+
new console window from being created. Use the following script
2354+
to test this interactively::
2355+
2356+
# Add the following lines to a script named
2357+
# should_not_open_console.pyw
2358+
from twisted.internet import reactor, utils
2359+
2360+
def write_result(result):
2361+
open("output.log", "w").write(repr(result))
2362+
reactor.stop()
2363+
2364+
PING_EXE = r"c:\windows\system32\ping.exe"
2365+
d = utils.getProcessOutput(PING_EXE, ["slashdot.org"])
2366+
d.addCallbacks(write_result)
2367+
reactor.run()
2368+
2369+
To test this, run::
2370+
2371+
pythonw.exe should_not_open_console.pyw
23552372
"""
23562373
from twisted.internet import _dumbwin32proc
23572374
flags = []

0 commit comments

Comments
 (0)