-SubprocessSpawnError::SubprocessSpawnError(const char* executable,
- int errCode,
- int errnoValue)
- : errnoValue_(errnoValue),
- what_(to<std::string>(errCode == kExecFailure ?
- "failed to execute " :
- "error preparing to execute ",
- executable, ": ", errnoStr(errnoValue))) {
+static inline std::string toSubprocessSpawnErrorMessage(
+ char const* executable,
+ int errCode,
+ int errnoValue) {
+ auto prefix = errCode == kExecFailure ? "failed to execute "
+ : "error preparing to execute ";
+ return to<std::string>(prefix, executable, ": ", errnoStr(errnoValue));