From 389d70a682825327e6cde32d9d401fb118c90e20 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 11 Jan 2021 10:17:02 -0500 Subject: [PATCH] see if GetCommandLine() value is interesting --- src/allmydata/test/test_windows.py | 11 ++++++++++- src/allmydata/windows/fixups.py | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/test_windows.py b/src/allmydata/test/test_windows.py index 1d8173de7..41a71150d 100644 --- a/src/allmydata/test/test_windows.py +++ b/src/allmydata/test/test_windows.py @@ -49,6 +49,7 @@ from testtools.matchers import ( from hypothesis import ( given, + note, ) from hypothesis.strategies import ( @@ -118,7 +119,15 @@ class GetArgvTests(SyncTestCase): PIPE, ) 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( returncode, Equals(0), diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index 2cdb1ad93..8537e06b5 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -26,8 +26,12 @@ def get_argv(): use_last_error=True )(("CommandLineToArgvW", windll.shell32)) + import sys + + command_line = GetCommandLine() + print("GetCommandLine() -> {!r}".format(command_line), file=sys.stderr) argc = c_int(0) - argv_unicode = CommandLineToArgvW(GetCommandLine(), byref(argc)) + argv_unicode = CommandLineToArgvW(command_line, byref(argc)) if argv_unicode is None: raise WinError(get_last_error())