From dbb06eac9bae1b8dbc50275b66c975da09b1d09a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 25 Sep 2018 23:22:08 +0200 Subject: Fix build with msvc (windows) Fix freeze when sub process (exec) returns a lot of data (in stdout) --- src/PkgConfig.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/PkgConfig.cpp') diff --git a/src/PkgConfig.cpp b/src/PkgConfig.cpp index 3a36f39..faed146 100644 --- a/src/PkgConfig.cpp +++ b/src/PkgConfig.cpp @@ -1,5 +1,4 @@ #include "../include/PkgConfig.hpp" -#if OS_FAMILY == OS_FAMILY_POSIX #include "../include/Exec.hpp" #include "../include/Dependency.hpp" @@ -35,9 +34,9 @@ namespace sibs Result PkgConfig::validatePackageExists(const string &name) { - string command = "pkg-config --exists '"; - command += name; - command += "'"; + FileString command = TINYDIR_STRING("pkg-config --exists '"); + command += toFileString(name); + command += TINYDIR_STRING("'"); Result execResult = exec(command.c_str()); if(execResult.isErr()) return Result::Err(execResult.getErrMsg()); @@ -69,11 +68,11 @@ namespace sibs // Use --modversion instead and check if the version returned is newer or equal to dependency version. // This way we can output installed version vs expected dependency version - string command = "pkg-config '--atleast-version="; - command += version; - command += "' '"; - command += name; - command += "'"; + FileString command = TINYDIR_STRING("pkg-config '--atleast-version="); + command += toFileString(version); + command += TINYDIR_STRING("' '"); + command += toFileString(name); + command += TINYDIR_STRING("'"); Result execResult = exec(command.c_str()); if(execResult.isErr()) return Result::Err(execResult.getErrMsg()); @@ -112,8 +111,8 @@ namespace sibs args += "'"; } - string command = "pkg-config --libs"; - command += args; + FileString command = TINYDIR_STRING("pkg-config --libs"); + command += toFileString(args); Result execResult = exec(command.c_str()); if(execResult.isErr()) return Result::Err(execResult.getErrMsg()); @@ -155,8 +154,8 @@ namespace sibs args += "'"; } - string command = "pkg-config --cflags"; - command += args; + FileString command = TINYDIR_STRING("pkg-config --cflags"); + command += toFileString(args); Result execResult = exec(command.c_str()); if(execResult.isErr()) return Result::Err(execResult.getErrMsg()); @@ -202,5 +201,4 @@ namespace sibs flags.cflags = move(cflagsResult.unwrap()); return Result::Ok(flags); } -} -#endif // OS_FAMILY_POSIX +} \ No newline at end of file -- cgit v1.2.3