Skip to content

Commit 4c8b9ee

Browse files
author
Nathan Baird
committed
Eliminate conhost.exe from git.exe and hooks process launches
GVFS launches git.exe processes with CreateNoWindow=true (or CREATE_NO_WINDOW in native code). Despite the name, this flag tells Windows to create a NEW hidden console for the child process, which allocates a conhost.exe instance. For frequent, small git operations (e.g. during prefetch), the per-process conhost creation/teardown overhead is disproportionately large. Fix: Set CreateNoWindow=false in GitProcess.cs. With UseShellExecute=false and stdout/stderr redirected to pipes, the child process inherits the parent's console state. Since GVFS.Mount runs as a service with no console, the child gets no console and no conhost. ProcessHelper.cs is left unchanged — it is used by gvfs.hooks.exe and gvfs.exe (CLI) which run with a console, where the existing behavior is appropriate. For native code (GitHooksLoader.cpp), replace CREATE_NO_WINDOW with DETACHED_PROCESS, which truly detaches from any console without allocating a new one. Reference: ToolLocationTransformer PR 15071136 (same pattern) Linked: ADO #62385282
1 parent 1e748bb commit 4c8b9ee

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

GVFS/GVFS.Common/Git/GitProcess.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ public Process GetGitProcess(string command, string workingDirectory, string dot
824824
processInfo.RedirectStandardOutput = true;
825825
processInfo.RedirectStandardError = redirectStandardError;
826826
processInfo.WindowStyle = ProcessWindowStyle.Hidden;
827-
processInfo.CreateNoWindow = true;
827+
processInfo.CreateNoWindow = false;
828828

829829
processInfo.StandardOutputEncoding = UTF8NoBOM;
830830
processInfo.StandardErrorEncoding = UTF8NoBOM;

GVFS/GitHooksLoader/GitHooksLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int ExecuteHook(const std::wstring &applicationName, wchar_t *hookName, int argc
129129
/* Git disallows stdin from hooks */
130130
si.dwFlags = STARTF_USESTDHANDLES;
131131

132-
creationFlags |= CREATE_NO_WINDOW;
132+
creationFlags |= DETACHED_PROCESS;
133133
}
134134

135135
ZeroMemory(&pi, sizeof(pi));

0 commit comments

Comments
 (0)