Check if a path exists and is executable. * On Windows, stat() doesn't set S_IXUSR — just check existence. */
| 1117 | /* Check if a path exists and is executable. |
| 1118 | * On Windows, stat() doesn't set S_IXUSR — just check existence. */ |
| 1119 | static bool is_executable(const char *path) { |
| 1120 | struct stat st; |
| 1121 | #ifdef _WIN32 |
| 1122 | return stat(path, &st) == 0; |
| 1123 | #else |
| 1124 | return stat(path, &st) == 0 && (st.st_mode & S_IXUSR); |
| 1125 | #endif |
| 1126 | } |
| 1127 | |
| 1128 | /* Search for an executable named `name` in the PATH environment variable. |
| 1129 | * Returns the full path in `out` (max out_sz) if found, else empty string. */ |
no test coverage detected