only attempt to monitor the modification time of a plugin if the command does not contain spaces

This commit is contained in:
Doug Hoyte
2023-09-08 17:57:08 -04:00
parent b2a128d2f3
commit 7da862eb91
2 changed files with 7 additions and 5 deletions

View File

@ -37,7 +37,7 @@ struct PluginEventSifter {
r = fdopen(rfd, "r");
w = fdopen(wfd, "w");
setlinebuf(w);
{
if (currPluginCmd.find(' ') == std::string::npos) {
struct stat statbuf;
if (stat(currPluginCmd.c_str(), &statbuf)) throw herr("couldn't stat plugin: ", currPluginCmd);
lastModTime = statbuf.st_mtim;
@ -64,7 +64,7 @@ struct PluginEventSifter {
if (running) {
if (pluginCmd != running->currPluginCmd) {
running.reset();
} else {
} else if (pluginCmd.find(' ') == std::string::npos) {
struct stat statbuf;
if (stat(pluginCmd.c_str(), &statbuf)) throw herr("couldn't stat plugin: ", pluginCmd);
if (statbuf.st_mtim.tv_sec != running->lastModTime.tv_sec || statbuf.st_mtim.tv_nsec != running->lastModTime.tv_nsec) {