I am writing a custom bash that executes commands in a serial and parallel fashion. When I try and echo anything out to the terminal, there is a space that becomes appended to the end of my line and it makes me fail a test case. There error is in my process command method:
Commands commandProcess(std::string line, bool parallel, bool single) {
// Create a list of commands to be returned if there
// is processing occurring.
Commands list; // vector of strings
// Set up a string stream to read the line
std::stringstream ss(line);
std::string cl = ""; // clean line
// While the string stream is still has unread info read
// through quotes and assign the commands to a list.
std::string temp = "";
while (ss >> std::quoted(temp)) {
cl += temp + " ";
list.push_back(temp);
}
boost::trim_right(cl);
std::cout << "Running: " << cl << std::endl;
// Run a one line argument
if (!parallel && single) {
ChildProcess cp;
cp.forkNexec(list);
std::cout << "Exit code: " << cp.wait() << std::endl;
}
return list;
}
Everything works fine in my program besides the echo command. Any guidance is extremely appreciated.
Aucun commentaire:
Enregistrer un commentaire