Stop processing commands when "quit" is found instead of crashing.
When using the library interface for processing commands, the "quit" command will terminate the application. Instead we intercept and just stop processing the command buffer and print a suitable message. Long-term, we perhaps may want to add a "QuitException" and throw that.
This commit is contained in:
@ -702,6 +702,13 @@ void lammps_commands_string(void *handle, const char *str)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// stop processing when quit command is found
|
||||
if (words.size() && (words[0] == "quit")) {
|
||||
if (lmp->comm->me == 0)
|
||||
utils::logmesg(lmp, "Encountered a 'quit' command. Stopping ...\n");
|
||||
break;
|
||||
}
|
||||
|
||||
lmp->input->one(cmd.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user