Check if a path exists and is executable. * On Windows, stat() doesn't set S_IXUSR — just check existence. */
| 899 | /* Check if a path exists and is executable. |
| 900 | * On Windows, stat() doesn't set S_IXUSR — just check existence. */ |
| 901 | static bool is_executable(const char *path) { |
| 902 | struct stat st; |
| 903 | #ifdef _WIN32 |
| 904 | return stat(path, &st) == 0; |
| 905 | #else |
| 906 | return stat(path, &st) == 0 && (st.st_mode & S_IXUSR); |
| 907 | #endif |
| 908 | } |
| 909 | |
| 910 | /* Search for an executable named `name` in the PATH environment variable. |
| 911 | * Returns the full path in `out` (max out_sz) if found, else empty string. */ |
no test coverage detected