filter out '\r' and '\n' from command string (macOS issue).

This commit is contained in:
2026-02-13 12:46:16 +01:00
parent db69044747
commit b255dad6a2

View File

@@ -935,9 +935,12 @@ int main(int argc, char *argv[])
} }
std::ostringstream oss; std::ostringstream oss;
oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions; oss << path << "musrfit" << " " << strInfile.str() << " " << musrfitOptions;
std::cout << std::endl << ">> msr2data: **INFO** Calling " << oss.str() << std::endl; std::string cmdStr = oss.str();
if (system(oss.str().c_str()) == -1) { cmdStr.erase(std::remove(cmdStr.begin(), cmdStr.end(), '\r'), cmdStr.end());
std::cerr << "**ERROR** cmd: " << oss.str().c_str() << " failed." << std::endl; cmdStr.erase(std::remove(cmdStr.begin(), cmdStr.end(), '\n'), cmdStr.end());
std::cout << std::endl << ">> msr2data: **INFO** Calling " << cmdStr << std::endl;
if (system(cmdStr.c_str()) == -1) {
std::cerr << "**ERROR** cmd: " << cmdStr << " failed." << std::endl;
} }
} }
} }