Check if a path exists and is executable. * On Windows, stat() doesn't set S_IXUSR — just check existence. */
| 243 | /* Check if a path exists and is executable. |
| 244 | * On Windows, stat() doesn't set S_IXUSR — just check existence. */ |
| 245 | static bool is_executable(const char *path) { |
| 246 | struct stat st; |
| 247 | #ifdef _WIN32 |
| 248 | return stat(path, &st) == 0; |
| 249 | #else |
| 250 | return stat(path, &st) == 0 && (st.st_mode & S_IXUSR); |
| 251 | #endif |
| 252 | } |
| 253 | |
| 254 | /* Search for an executable named `name` in the PATH environment variable. |
| 255 | * Returns the full path in `out` (max out_sz) if found, else empty string. */ |
no test coverage detected