Renabled subprocess
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
#include <codecvt>
|
||||
#include <filesystem>
|
||||
|
||||
//#include <Subprocess.hpp>
|
||||
#include <Subprocess.hpp>
|
||||
|
||||
namespace Nuake {
|
||||
|
||||
@@ -176,40 +176,39 @@ namespace Nuake {
|
||||
}
|
||||
|
||||
command_line.back() = nullptr;
|
||||
|
||||
int result = 0;
|
||||
//struct subprocess_s subprocess;
|
||||
|
||||
struct subprocess_s subprocess;
|
||||
char output[1024];
|
||||
//int result = subprocess_create(command_line.data(), subprocess_option_inherit_environment, &subprocess);
|
||||
//if (0 != result) {
|
||||
// // an error occurred!
|
||||
//}
|
||||
//
|
||||
//int process_return;
|
||||
//result = subprocess_join(&subprocess, &process_return);
|
||||
//if (0 != result) {
|
||||
// // an error occurred!
|
||||
//}
|
||||
//
|
||||
//FILE* p_stdout = subprocess_stdout(&subprocess);
|
||||
//
|
||||
//std::string stdout_output;
|
||||
//fgets(output, 1024, p_stdout);
|
||||
//while (fgets(output, sizeof(output), p_stdout))
|
||||
//{
|
||||
// stdout_output += output;
|
||||
//}
|
||||
//
|
||||
//FILE* p_stderr = subprocess_stderr(&subprocess);
|
||||
//std::string stderr_output;
|
||||
//char errOutput[1024];
|
||||
//while (fgets(errOutput, sizeof(errOutput), p_stderr))
|
||||
//{
|
||||
// stderr_output += errOutput;
|
||||
//}
|
||||
//
|
||||
//out = stdout_output;
|
||||
//err = stderr_output;
|
||||
int result = subprocess_create(command_line.data(), subprocess_option_inherit_environment, &subprocess);
|
||||
if (0 != result) {
|
||||
// an error occurred!
|
||||
}
|
||||
|
||||
int process_return;
|
||||
result = subprocess_join(&subprocess, &process_return);
|
||||
if (0 != result) {
|
||||
// an error occurred!
|
||||
}
|
||||
|
||||
FILE* p_stdout = subprocess_stdout(&subprocess);
|
||||
|
||||
std::string stdout_output;
|
||||
fgets(output, 1024, p_stdout);
|
||||
while (fgets(output, sizeof(output), p_stdout))
|
||||
{
|
||||
stdout_output += output;
|
||||
}
|
||||
|
||||
FILE* p_stderr = subprocess_stderr(&subprocess);
|
||||
std::string stderr_output;
|
||||
char errOutput[1024];
|
||||
while (fgets(errOutput, sizeof(errOutput), p_stderr))
|
||||
{
|
||||
stderr_output += errOutput;
|
||||
}
|
||||
|
||||
out = stdout_output;
|
||||
err = stderr_output;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
1217
Nuake/Vendors/Subprocess/Subprocess.hpp
Normal file
1217
Nuake/Vendors/Subprocess/Subprocess.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -49,11 +49,13 @@ project "Nuake"
|
||||
"Vendors/incbin/*.c",
|
||||
"Vendors/incbin/*.h",
|
||||
"Vendors/nanosvg/*.h",
|
||||
"Vendors/Subprocess/*.hpp",
|
||||
"Vendors/volk/*.c",
|
||||
"Vendors/volk/*.h",
|
||||
"Vendors/vkb/*.cpp",
|
||||
"Vendors/vkb/*.h",
|
||||
"Vendors/vulkan/**.h",
|
||||
"Vendors/Subprocess/**.hpp",
|
||||
-- Modules System
|
||||
"Source/Nuake/Modules/Modules.h",
|
||||
"Source/Nuake/Modules/Modules.cpp",
|
||||
@@ -73,6 +75,7 @@ project "Nuake"
|
||||
"Vendors/incbin",
|
||||
"Vendors/nanosvg",
|
||||
"Vendors/vkb",
|
||||
"Vendors/Subprocess",
|
||||
"Thirdparty/build",
|
||||
"Thirdparty/soloud/include",
|
||||
"Thirdparty/Coral/Coral.Native/Include",
|
||||
|
||||
Reference in New Issue
Block a user