The POSIX error for a missing command is not stable across systems. Some
environments report the posix_spawnp failure directly, while others
return a shell-style "Non-zero exit code: 127" instead.
Accept both outcomes in the test and capture the actual error string to
make future failures easier to diagnose.
#ifdef _WIN32
CHECK(result.error().starts_with("CreateProcess failure: "));
#else
- CHECK(result.error() == "posix_spawnp failed: No such file or directory");
+ CAPTURE(result.error());
+ const bool expected_spawn_failure =
+ result.error().starts_with("posix_spawnp failed: ")
+ || result.error() == "Non-zero exit code: 127";
+ CHECK(expected_spawn_failure);
#endif
}
}