Commit 9508266
committed
Use Console.IsOutputRedirected instead of P/Invoke for redirect detection
The previous IsConsoleOutputRedirectedToFile() used Win32 GetFileType to
check if stdout was redirected to a disk file. This missed the pipe case
(GetFileType returns Pipe, not Disk), so the console spinner would still
run when stdout was captured via Process.Start with RedirectStandardOutput
(e.g. in functional tests and CI), polluting captured output with \r and
spinner characters.
Replace with .NET's Console.IsOutputRedirected which returns true for any
non-console handle (files, pipes, NUL). Remove the now-unused P/Invoke
declarations (GetStdHandle, GetFileType) and the platform abstraction
(IsConsoleOutputRedirectedToFile) from GVFSPlatform, WindowsPlatform,
GVFSHooksPlatform, and MockPlatform.
Assisted-by: Claude Opus 4.6
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>1 parent 73e8e29 commit 9508266
8 files changed
Lines changed: 4 additions & 49 deletions
File tree
- GVFS
- GVFS.Common
- GVFS.Hooks
- HooksPlatform
- GVFS.Platform.Windows
- GVFS.UnitTests/Mock/Common
- GVFS/CommandLine
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | 106 | | |
109 | 107 | | |
110 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 17 | | |
35 | 18 | | |
36 | 19 | | |
| |||
153 | 136 | | |
154 | 137 | | |
155 | 138 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | 139 | | |
162 | 140 | | |
163 | 141 | | |
| |||
177 | 155 | | |
178 | 156 | | |
179 | 157 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | 158 | | |
187 | 159 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 334 | | |
340 | 335 | | |
341 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 134 | | |
140 | 135 | | |
141 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
0 commit comments