see if GetCommandLine() value is interesting

This commit is contained in:
Jean-Paul Calderone 2021-01-11 10:17:02 -05:00
parent e2f3964451
commit 389d70a682
2 changed files with 15 additions and 2 deletions

View File

@ -49,6 +49,7 @@ from testtools.matchers import (
from hypothesis import ( from hypothesis import (
given, given,
note,
) )
from hypothesis.strategies import ( from hypothesis.strategies import (
@ -118,7 +119,15 @@ class GetArgvTests(SyncTestCase):
PIPE, PIPE,
) )
argv = [executable.decode("utf-8"), save_argv_path.path] + argv argv = [executable.decode("utf-8"), save_argv_path.path] + argv
returncode = Popen(argv, stdin=PIPE, stdout=PIPE, stderr=PIPE).wait() p = Popen(argv, stdin=PIPE, stdout=PIPE, stderr=PIPE)
p.stdin.close()
stdout = p.stdout.read()
stderr = p.stderr.read()
returncode = p.wait()
note("stdout: {!r}".format(stdout))
note("stderr: {!r}".format(stderr))
self.assertThat( self.assertThat(
returncode, returncode,
Equals(0), Equals(0),

View File

@ -26,8 +26,12 @@ def get_argv():
use_last_error=True use_last_error=True
)(("CommandLineToArgvW", windll.shell32)) )(("CommandLineToArgvW", windll.shell32))
import sys
command_line = GetCommandLine()
print("GetCommandLine() -> {!r}".format(command_line), file=sys.stderr)
argc = c_int(0) argc = c_int(0)
argv_unicode = CommandLineToArgvW(GetCommandLine(), byref(argc)) argv_unicode = CommandLineToArgvW(command_line, byref(argc))
if argv_unicode is None: if argv_unicode is None:
raise WinError(get_last_error()) raise WinError(get_last_error())