|
21 | 21 | #include "html_generation.hpp" |
22 | 22 | #include <fstream> |
23 | 23 | #include <iostream> |
| 24 | +#include <boost/asio/io_context.hpp> |
| 25 | +#include <boost/process/v2/process.hpp> |
| 26 | +#include <boost/process/v2/posix/fork_and_forget_launcher.hpp> |
24 | 27 | #include "browser_detection.hpp" |
25 | 28 | #include "Config.hpp" |
26 | 29 | #include "paths.hpp" |
@@ -64,15 +67,14 @@ void openFirstIndexFile(const FolderMap& fm, const std::string& html_dir) |
64 | 67 | << "Info: Open " << fullFileName << " in a browser to see the generated HTML files.\n"; |
65 | 68 | return; |
66 | 69 | } |
67 | | - // TODO: Open file via Boost Process. |
68 | | - std::cout << "Run\n\n\t" << browser.value().path.string(); |
69 | | - const auto params = additional_parameters(browser.value().type); |
70 | | - for (const auto& param: params) |
71 | | - { |
72 | | - std::cout << " " << param; |
73 | | - } |
74 | | - std::cout << " " << fullFileName << "\n\n" |
75 | | - << "to show the generated HTML output.\n"; |
| 70 | + // Open file via Boost Process. |
| 71 | + std::cout << "Opening " << fullFileName << " in browser ...\n"; |
| 72 | + boost::asio::io_context context; |
| 73 | + std::vector<std::string> params = additional_parameters(browser.value().type); |
| 74 | + params.push_back(fullFileName); |
| 75 | + auto launcher = boost::process::v2::posix::fork_and_forget_launcher(); |
| 76 | + boost::process::v2::process proc(context, browser.value().path.string(), params); |
| 77 | + proc.detach(); |
76 | 78 | } |
77 | 79 |
|
78 | 80 | int generateHtmlFiles(const MessageDatabase& mdb, const FolderMap& fm, const HTMLOptions htmlOptions) |
|
0 commit comments