summaryrefslogtreecommitdiffstats
path: root/osdep/win32-console-wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/win32-console-wrapper.c')
-rw-r--r--osdep/win32-console-wrapper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/osdep/win32-console-wrapper.c b/osdep/win32-console-wrapper.c
index c8c297b482..8cebcf8c83 100644
--- a/osdep/win32-console-wrapper.c
+++ b/osdep/win32-console-wrapper.c
@@ -72,5 +72,9 @@ int wmain(int argc, wchar_t **argv, wchar_t **envp)
GetModuleFileNameW(NULL, exe, MAX_PATH);
wcscpy(wcsrchr(exe, '.') + 1, L"exe");
+ // Set an environment variable so the child process can tell whether it
+ // was started from this wrapper and attach to the console accordingly
+ SetEnvironmentVariableW(L"_started_from_console", L"yes");
+
return cr_runproc(exe, cmd);
}