diff --git a/src/terminal.cpp b/src/terminal.cpp index d900baa..f58fb21 100644 --- a/src/terminal.cpp +++ b/src/terminal.cpp @@ -272,8 +272,19 @@ std::shared_ptr Terminal::async_process(const std::stri scroll_to_bottom(); stdin_buffer.clear(); +#if !defined(__APPLE__) && !defined(_WIN32) + static auto stdbuf = filesystem::find_executable("stdbuf").string(); +#endif + auto process = std::make_shared( - "STDBUF1=L " + command, path.string(), +#if defined(__APPLE__) + "STDBUF1=L " + command, +#elif defined(_WIN32) + command, +#else + !stdbuf.empty() ? std::vector{stdbuf, "-oL", "/bin/sh", "-c", command} : std::vector{"/bin/sh", "-c", command}, +#endif + path.string(), [this, quiet](const char *bytes, size_t n) { if(!quiet) { // Print stdout message sequentially to avoid the GUI becoming unresponsive