Skip to content

Commit

Permalink
Exit with '_exit' when zenity is missing
Browse files Browse the repository at this point in the history
Per comment from @falkTX on surge-synthesizer#1199 this will stop our missing-zenity-core
  • Loading branch information
baconpaul committed Sep 21, 2019
1 parent a3c5031 commit f7225b0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/linux/UserInteractionsLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void promptError(const std::string &message, const std::string &title,
"--title", title.c_str(),
(char*)nullptr) < 0)
{
exit(0);
_exit(0);
}
}
std::cerr << "Surge Error\n"
Expand Down Expand Up @@ -91,7 +91,7 @@ MessageResult promptOKCancel(const std::string &message, const std::string &titl
"--text", message.c_str(),
"--title", title.c_str(),
(char*)nullptr);
exit(1);
_exit(65);
}

int wret;
Expand All @@ -105,8 +105,16 @@ MessageResult promptOKCancel(const std::string &message, const std::string &titl
return UserInteractions::CANCEL;
}

return (WEXITSTATUS(wstatus) == 0) ?
UserInteractions::OK : UserInteractions::CANCEL;
auto status = WEXITSTATUS(wstatus);
switch( status )
{
case 0:
case 65:
// zenity worked or was not installed
return UserInteractions::OK;
default:
return UserInteractions::CANCEL;
}
}

void openURL(const std::string &url)
Expand All @@ -115,7 +123,7 @@ void openURL(const std::string &url)
{
if (execlp("xdg-open", "xdg-open", url.c_str(), (char*)nullptr) < 0)
{
exit(0);
_exit(0);
}
}
}
Expand Down

0 comments on commit f7225b0

Please sign in to comment.