| 1 | package shellrun |
| 2 | |
| 3 | import "strings" |
| 4 | |
| 5 | // WindowsRuntimeDiagnostic recognizes stderr evidence, never a bare exit code. |
| 6 | // The failure may belong to an external child after earlier commands ran, so |
| 7 | // callers must not relabel an ordinary execution failure as mutation-not-started. |
| 8 | func WindowsRuntimeDiagnostic(output string) string { |
| 9 | text := strings.ToLower(output) |
| 10 | if !strings.Contains(text, "fatal error") && !strings.Contains(text, "cygheap_user::init") { |
| 11 | return "" |
| 12 | } |
| 13 | if (strings.Contains(text, "createfilemapping") && strings.Contains(text, "win32 error 5")) || |
| 14 | (strings.Contains(text, "cygheap_user::init") && strings.Contains(text, "ntsetinformationtoken") && strings.Contains(text, "0xc0000022")) { |
| 15 | return "Windows denied MSYS/Cygwin runtime initialization (access denied). Check compatibility with the current sandbox and token permissions; repeating commands through the same failing runtime will not repair it. Sandbox restrictions remain in effect" |
| 16 | } |
| 17 | return "" |
| 18 | } |
| 19 |