From 79a281ffdd38c20182a71b2d706bad8e6b351a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oleksis=20Fraga=20Men=C3=A9ndez?= Date: Fri, 6 Jan 2023 22:53:58 -0500 Subject: [PATCH] Ability to return the version of Python launcher running --- PC/launcher2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PC/launcher2.c b/PC/launcher2.c index 9b3db04aa48b72..29329cc8a7387c 100644 --- a/PC/launcher2.c +++ b/PC/launcher2.c @@ -407,6 +407,8 @@ typedef struct { bool listPaths; // if true, display help message before contiuning bool help; + // if true, display Python Launcher version before contiuning + bool version; // dynamically allocated buffers to free later struct _SearchInfoBuffer *_buffer; } SearchInfo; @@ -647,6 +649,8 @@ parseCommandLine(SearchInfo *search) search->help = true; // Do not update restOfCmdLine so that we trigger the help // message from whichever interpreter we select + } else if (STARTSWITH(L"V") || STARTSWITH(L"-version")) { + search->version = true; } } } @@ -2464,6 +2468,11 @@ process(int argc, wchar_t ** argv) } } + if (search.version) { + fwprintf(stdout, L"Python launcher for Windows %S\n", PY_VERSION); + fflush(stdout); + } + // Select best environment // This is early so that we can show the default when listing, but all // responses to any errors occur later.