Commit 6c01575
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 each 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.
Changes:
- GitProcess.cs: Set CreateNoWindow=false. With UseShellExecute=false
and stdout/stderr redirected to pipes, the child inherits the
parent's console state. Since GVFS.Mount runs as a service with no
console, the child gets no console and no conhost. Also remove the
unused redirectStandardError parameter (all callers pass true).
- ProcessHelper.cs: Set CreateNoWindow=false unconditionally. When
redirectOutput is true, I/O goes through pipes so no console is
needed. When redirectOutput is false, the child inherits the
parent's console handles, which is correct for terminal contexts
and harmless in service contexts (output was already going to an
invisible hidden console).
- GitHooksLoader.cpp: Use DETACHED_PROCESS instead of
CREATE_NO_WINDOW in the no-console branch. Explicitly detaches
from any console without allocating a new one. The console branch
(user terminal) is unchanged.
Verified with edge-case tests across terminal, hidden-console, and
fully-detached (DETACHED_PROCESS) parent contexts. All git status,
git fetch (prefetch hook), and gvfs health scenarios pass.
Assisted-by: Tyrie Vella <tyrielv@gmail.com>
Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>1 parent 1e748bb commit 6c01575
3 files changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
818 | | - | |
| 818 | + | |
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
825 | | - | |
| 825 | + | |
826 | 826 | | |
827 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
828 | 836 | | |
829 | 837 | | |
830 | 838 | | |
| |||
903 | 911 | | |
904 | 912 | | |
905 | 913 | | |
906 | | - | |
| 914 | + | |
907 | 915 | | |
908 | 916 | | |
909 | 917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
0 commit comments