|
|
|
|
@ -204,6 +204,10 @@ Terminal::Terminal() : Source::CommonView() {
|
|
|
|
|
|
|
|
|
|
int Terminal::process(const std::string &command, const boost::filesystem::path &path, bool use_pipes) { |
|
|
|
|
std::unique_ptr<TinyProcessLib::Process> process; |
|
|
|
|
TinyProcessLib::Config processConfig{}; |
|
|
|
|
#ifdef JUCI_FLATPAK_SANDBOX |
|
|
|
|
processConfig.flatpak_spawn_host = true; |
|
|
|
|
#endif |
|
|
|
|
if(use_pipes) |
|
|
|
|
process = std::make_unique<TinyProcessLib::Process>( |
|
|
|
|
command, path.string(), |
|
|
|
|
@ -212,9 +216,10 @@ int Terminal::process(const std::string &command, const boost::filesystem::path
|
|
|
|
|
}, |
|
|
|
|
[this](const char *bytes, size_t n) { |
|
|
|
|
async_print(std::string(bytes, n), true); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
false, processConfig); |
|
|
|
|
else |
|
|
|
|
process = std::make_unique<TinyProcessLib::Process>(command, path.string()); |
|
|
|
|
process = std::make_unique<TinyProcessLib::Process>(command, path.string(), nullptr, nullptr, false, processConfig); |
|
|
|
|
|
|
|
|
|
if(process->get_id() <= 0) { |
|
|
|
|
async_print("\e[31mError\e[m: failed to run command: " + command + "\n", true); |
|
|
|
|
@ -225,6 +230,10 @@ int Terminal::process(const std::string &command, const boost::filesystem::path
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Terminal::process(std::istream &stdin_stream, std::ostream &stdout_stream, const std::string &command, const boost::filesystem::path &path, std::ostream *stderr_stream) { |
|
|
|
|
TinyProcessLib::Config processConfig{}; |
|
|
|
|
#ifdef JUCI_FLATPAK_SANDBOX |
|
|
|
|
processConfig.flatpak_spawn_host = true; |
|
|
|
|
#endif |
|
|
|
|
TinyProcessLib::Process process( |
|
|
|
|
command, path.string(), |
|
|
|
|
[&stdout_stream](const char *bytes, size_t n) { |
|
|
|
|
@ -243,7 +252,7 @@ int Terminal::process(std::istream &stdin_stream, std::ostream &stdout_stream, c
|
|
|
|
|
else |
|
|
|
|
async_print(std::string(bytes, n), true); |
|
|
|
|
}, |
|
|
|
|
true); |
|
|
|
|
true, processConfig); |
|
|
|
|
|
|
|
|
|
if(process.get_id() <= 0) { |
|
|
|
|
async_print("\e[31mError\e[m: failed to run command: " + command + "\n", true); |
|
|
|
|
@ -288,6 +297,11 @@ std::shared_ptr<TinyProcessLib::Process> Terminal::async_process(const std::stri
|
|
|
|
|
cd_path_and_command = command; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
TinyProcessLib::Config processConfig{}; |
|
|
|
|
#ifdef JUCI_FLATPAK_SANDBOX |
|
|
|
|
processConfig.flatpak_spawn_host = true; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
auto process = std::make_shared<TinyProcessLib::Process>( |
|
|
|
|
#if defined(__APPLE__) |
|
|
|
|
"STDBUF1=L " + command, |
|
|
|
|
@ -321,7 +335,7 @@ std::shared_ptr<TinyProcessLib::Process> Terminal::async_process(const std::stri
|
|
|
|
|
message_printed.get_future().get(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
true); |
|
|
|
|
true, processConfig); |
|
|
|
|
|
|
|
|
|
auto pid = process->get_id(); |
|
|
|
|
if(pid <= 0) { |
|
|
|
|
|