Skip to content

Commit

Permalink
System.Exec parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzard committed Aug 18, 2019
1 parent 5aaa190 commit d62d573
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion xbmc/Application.cpp
Expand Up @@ -2140,7 +2140,7 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg)
#if defined(TARGET_DARWIN)
CLog::Log(LOGNOTICE, "ExecWait is not implemented on this platform");
#elif defined(TARGET_POSIX)
CUtil::RunCommandLine(pMsg->strParam.c_str(), (pMsg->param1 == 1));
CUtil::RunCommandLine(pMsg->params, (pMsg->param1 == 1));
#elif defined(TARGET_WINDOWS)
CWIN32Util::XBMCShellExecute(pMsg->strParam.c_str(), (pMsg->param1 == 1));
#endif
Expand Down
6 changes: 4 additions & 2 deletions xbmc/Util.cpp
Expand Up @@ -1575,9 +1575,9 @@ void CUtil::InitRandomSeed()
}

#ifdef TARGET_POSIX
bool CUtil::RunCommandLine(const std::string& cmdLine, bool waitExit)
bool CUtil::RunCommandLine(const std::vector<std::string> argArray, bool waitExit)
{
std::vector<std::string> args = StringUtils::Split(cmdLine, ",");
std::vector<std::string> args = argArray;

// Strip quotes and whitespace around the arguments, or exec will fail.
// This allows the python invocation to be written more naturally with any amount of whitespace around the args.
Expand Down Expand Up @@ -1632,6 +1632,8 @@ bool CUtil::Command(const std::vector<std::string>& arrArgs, bool waitExit)
memset(args, 0, (sizeof(char *) * (arrArgs.size() + 3)));
for (size_t i=0; i<arrArgs.size(); i++)
args[i] = const_cast<char *>(arrArgs[i].c_str());
args[arrArgs.size()] = NULL;

execvp(args[0], args);
}
}
Expand Down
2 changes: 1 addition & 1 deletion xbmc/Util.h
Expand Up @@ -177,7 +177,7 @@ class CUtil
//
// Forks to execute an unparsed shell command line.
//
static bool RunCommandLine(const std::string& cmdLine, bool waitExit = false);
static bool RunCommandLine(const std::vector<std::string> argArray, bool waitExit);
#endif
static std::string ResolveExecutablePath();
static std::string GetFrameworksPath(bool forPython = false);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/interfaces/builtins/SystemBuiltins.cpp
Expand Up @@ -23,7 +23,7 @@ using namespace KODI::MESSAGING;
static int Exec(const std::vector<std::string>& params)
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_MINIMIZE);
CApplicationMessenger::GetInstance().PostMsg(TMSG_EXECUTE_OS, Wait, -1, nullptr, params[0]);
CApplicationMessenger::GetInstance().PostMsg(TMSG_EXECUTE_OS, Wait, -1, nullptr, params[0], params);

return 0;
}
Expand Down

0 comments on commit d62d573

Please sign in to comment.