diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-18 18:09:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-18 18:09:57 +0300 |
commit | e36b143b5a6b5dadae90d9095fc60c16695de764 (patch) | |
tree | 53baf6fcb0f0b7b1aa51a739615a741797a0f34a /src | |
parent | 962229519bb4b84985515861eb9afefa09dcdda5 (diff) | |
download | manaplus-e36b143b5a6b5dadae90d9095fc60c16695de764.tar.gz manaplus-e36b143b5a6b5dadae90d9095fc60c16695de764.tar.bz2 manaplus-e36b143b5a6b5dadae90d9095fc60c16695de764.tar.xz manaplus-e36b143b5a6b5dadae90d9095fc60c16695de764.zip |
improve process file.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/process.cpp | 27 | ||||
-rw-r--r-- | src/utils/process.h | 9 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/utils/process.cpp b/src/utils/process.cpp index f51d7924e..4a447848c 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -38,8 +38,9 @@ const int timeOut = 10; #include <windows.h> -int execFileWait(std::string pathName, std::string name A_UNUSED, - std::string arg1, std::string arg2, int waitTime A_UNUSED) +int execFileWait(const std::string &pathName, const std::string &name A_UNUSED, + const std::string &arg1, const std::string &arg2, + const int waitTime A_UNUSED) { // if (!waitTime) // waitTime = timeOut; @@ -75,8 +76,8 @@ int execFileWait(std::string pathName, std::string name A_UNUSED, return -1; } -bool execFile(std::string pathName, std::string name A_UNUSED, - std::string arg1, std::string arg2) +bool execFile(const std::string &pathName, const std::string &name A_UNUSED, + const std::string &arg1, const std::string &arg2) { STARTUPINFO siStartupInfo; PROCESS_INFORMATION piProcessInfo; @@ -105,8 +106,9 @@ bool execFile(std::string pathName, std::string name A_UNUSED, #include <sys/wait.h> #include <signal.h> -int execFileWait(std::string pathName, std::string name, - std::string arg1, std::string arg2, int waitTime) +int execFileWait(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2, + int waitTime) { pid_t mon_pid; int status; @@ -180,8 +182,8 @@ int execFileWait(std::string pathName, std::string name, return -1; } -bool execFile(std::string pathName, std::string name, - std::string arg1, std::string arg2) +bool execFile(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2) { struct stat statbuf; // file not exists @@ -213,14 +215,15 @@ bool execFile(std::string pathName, std::string name, #else -int execFileWait(std::string pathName, std::string name, - std::string arg1, std::string arg2, int waitTime) +int execFileWait(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2, + int waitTime) { return -1; } -bool execFile(std::string pathName, std::string name, - std::string arg1, std::string arg2) +bool execFile(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2) { return false; } diff --git a/src/utils/process.h b/src/utils/process.h index c3de0d175..1652dcce0 100644 --- a/src/utils/process.h +++ b/src/utils/process.h @@ -23,11 +23,12 @@ #include <string> -int execFileWait(std::string pathName, std::string name, - std::string arg1, std::string arg2, int waitTime = 0); +int execFileWait(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2, + int waitTime = 0); -bool execFile(std::string pathName, std::string name, - std::string arg1, std::string arg2); +bool execFile(const std::string &pathName, const std::string &name, + const std::string &arg1, const std::string &arg2); bool openBrowser(std::string url); |