Check if a path exists and is executable. * On Windows, stat() doesn't set S_IXUSR — just check existence. */
| 921 | /* Check if a path exists and is executable. |
| 922 | * On Windows, stat() doesn't set S_IXUSR — just check existence. */ |
| 923 | static bool is_executable(const char *path) { |
| 924 | struct stat st; |
| 925 | #ifdef _WIN32 |
| 926 | return stat(path, &st) == 0; |
| 927 | #else |
| 928 | return stat(path, &st) == 0 && (st.st_mode & S_IXUSR); |
| 929 | #endif |
| 930 | } |
| 931 | |
| 932 | /* Search for an executable named `name` in the PATH environment variable. |
| 933 | * Returns the full path in `out` (max out_sz) if found, else empty string. */ |
no test coverage detected