Skip to content

Commit 981dfb1

Browse files
committed
mingw: add the debug.issue1481 config setting to help debug further
In case that the previous commit does not quite fix things, let's add some debug code that is guarded by the special-purpose `debug.issue1481` config setting. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 081b5fd commit 981dfb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compat/mingw.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,15 @@ static enum hide_dotfiles_type hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
243243
static char *unset_environment_variables;
244244
int core_fscache;
245245
int core_long_paths;
246+
int debug_1481;
246247

247248
int mingw_core_config(const char *var, const char *value, void *cb)
248249
{
250+
if (!strcmp(var, "debug.issue1481")) {
251+
debug_1481 = git_config_bool(var, value);
252+
return 0;
253+
}
254+
249255
if (!strcmp(var, "core.hidedotfiles")) {
250256
if (value && !strcasecmp(value, "dotgitonly"))
251257
hide_dotfiles = HIDE_DOTFILES_DOTGITONLY;
@@ -1752,15 +1758,18 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
17521758
*/
17531759
if (!ret && restrict_handle_inheritance && stdhandles_count) {
17541760
DWORD err = GetLastError();
1761+
if (debug_1481) warning("error: %d", (int)err);
17551762
if (err == ERROR_NO_SYSTEM_RESOURCES ||
1756-
err == ERROR_INVALID_HANDLE) {
1763+
err == ERROR_INVALID_HANDLE || debug_1481) {
17571764
restrict_handle_inheritance = 0;
17581765
flags &= ~EXTENDED_STARTUPINFO_PRESENT;
17591766
ret = CreateProcessW(*wcmd ? wcmd : NULL, wargs, NULL,
17601767
NULL, TRUE, flags, wenvblk,
17611768
dir ? wdir : NULL,
17621769
&si.StartupInfo, &pi);
1770+
if (debug_1481) warning("spawn2 %s, err: %d", ret ? "successful" : "failed", (int)GetLastError());
17631771
}
1772+
else error("spawn2 not even attempted");
17641773
}
17651774

17661775
if (!ret)

0 commit comments

Comments
 (0)