Don't block when executing external commands
This commit is contained in:
@@ -87,7 +87,7 @@ RunExternalCommand::RunExternalCommand(std::string &&command)
|
|||||||
|
|
||||||
void RunExternalCommand::run()
|
void RunExternalCommand::run()
|
||||||
{
|
{
|
||||||
runExternalCommand(m_command, false);
|
runExternalCommand(m_command, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunExternalConsoleCommand::RunExternalConsoleCommand(std::string &&command)
|
RunExternalConsoleCommand::RunExternalConsoleCommand(std::string &&command)
|
||||||
@@ -118,5 +118,6 @@ void runExternalCommand(const std::string &cmd, bool block)
|
|||||||
if (block)
|
if (block)
|
||||||
std::system(cmd.c_str());
|
std::system(cmd.c_str());
|
||||||
else
|
else
|
||||||
std::system(("nohup " + cmd + " &").c_str());
|
// If we don't block, disregard any output.
|
||||||
|
std::system(("nohup " + cmd + " >/dev/null 2>&1 &").c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -570,7 +570,11 @@ void Status::Changes::songID(int song_id)
|
|||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
if (!Config.execute_on_song_change.empty())
|
if (!Config.execute_on_song_change.empty())
|
||||||
runExternalCommand(Config.execute_on_song_change, false);
|
{
|
||||||
|
// We need to block to allow sending output to the terminal so a script
|
||||||
|
// can e.g. set the album art.
|
||||||
|
runExternalCommand(Config.execute_on_song_change, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.fetch_lyrics_in_background)
|
if (Config.fetch_lyrics_in_background)
|
||||||
myLyrics->fetchInBackground(s, false);
|
myLyrics->fetchInBackground(s, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user