Skip to content

Commit fd669b8

Browse files
committed
WIP: open a generated HTML file in browser
1 parent 92e33f1 commit fd669b8

File tree

9 files changed

+21
-18
lines changed

9 files changed

+21
-18
lines changed

.github/workflows/alpine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install packages
2424
run: |
2525
apk update
26-
apk add catch2 cmake g++ libxml2-dev make pkgconf zlib-dev
26+
apk add boost-dev catch2 cmake g++ libxml2-dev make pkgconf zlib-dev
2727
apk add firefox-esr
2828
- name: Build
2929
run: |

.github/workflows/alpine_arm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- name: Install packages
4747
run: |
4848
apk update
49-
apk add catch2 cmake g++ libxml2-dev make pkgconf zlib-dev
49+
apk add boost-dev catch2 cmake g++ libxml2-dev make pkgconf zlib-dev
5050
apk add firefox-esr
5151
- name: Build
5252
run: |

.github/workflows/clang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install Debian packages
3434
run: |
3535
sudo apt-get update
36-
sudo apt-get install -y catch cmake clang-${{ matrix.version }} libxml2-dev pkg-config zlib1g-dev
36+
sudo apt-get install -y catch cmake clang-${{ matrix.version }} libboost-dev libxml2-dev pkg-config zlib1g-dev
3737
- name: Build with Clang ${{ matrix.version }}
3838
run: |
3939
export CXX=clang++-${{ matrix.version }}

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Debian packages
2222
run: |
2323
sudo apt-get update
24-
sudo apt-get install -y catch2 cmake g++-${{ matrix.version }} libxml2-dev pkg-config zlib1g-dev
24+
sudo apt-get install -y catch2 cmake g++-${{ matrix.version }} libboost-dev libxml2-dev pkg-config zlib1g-dev
2525
sudo apt-get install -y lcov
2626
- name: Build with GNU GCC ${{ matrix.version }}
2727
run: |

.github/workflows/gcc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install Debian packages
3232
run: |
3333
sudo apt-get update
34-
sudo apt-get install -y catch cmake g++-${{ matrix.version }} libxml2-dev pkg-config zlib1g-dev
34+
sudo apt-get install -y catch cmake g++-${{ matrix.version }} libboost-dev libxml2-dev pkg-config zlib1g-dev
3535
- name: Build with GNU GCC ${{ matrix.version }}
3636
run: |
3737
export CXX=g++-${{ matrix.version }}

.github/workflows/msys2.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
update: true
2424
install: >-
2525
git
26+
mingw-w64-x86_64-boost
2627
mingw-w64-x86_64-catch
2728
mingw-w64-x86_64-cmake
2829
mingw-w64-x86_64-gcc

.github/workflows/sanitizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Debian packages
2222
run: |
2323
sudo apt-get update
24-
sudo apt-get install -y catch2 cmake g++-${{ matrix.version }} libxml2-dev pkg-config zlib1g-dev
24+
sudo apt-get install -y catch2 cmake g++-${{ matrix.version }} libboost-dev libxml2-dev pkg-config zlib1g-dev
2525
sudo apt-get install -y libasan8 libubsan1
2626
- name: Build with GNU GCC ${{ matrix.version }}
2727
run: |

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build_gcc:
1010
stage: build
1111
before_script:
1212
- apt-get update
13-
- apt-get -y install catch cmake g++ libxml2 libxml2-dev zlib1g-dev
13+
- apt-get -y install catch cmake g++ libboost-dev libxml2 libxml2-dev zlib1g-dev
1414
- apt-get install -y firefox-esr --no-install-recommends
1515
# Remove parts of the submodule that are not used but would get into CI's
1616
# way when linting.
@@ -35,7 +35,7 @@ build_clang:
3535
stage: build
3636
before_script:
3737
- apt-get update
38-
- apt-get -y install catch cmake clang libxml2 libxml2-dev pkg-config zlib1g-dev
38+
- apt-get -y install catch cmake clang libboost-dev libxml2 libxml2-dev pkg-config zlib1g-dev
3939
- apt-get install -y firefox-esr --no-install-recommends
4040
# Remove parts of the submodule that are not used but would get into CI's
4141
# way when linting.
@@ -61,7 +61,7 @@ coverage:
6161
stage: build
6262
before_script:
6363
- apt-get update
64-
- apt-get -y install catch cmake g++ lcov libxml2 libxml2-dev pkg-config zlib1g-dev
64+
- apt-get -y install catch cmake g++ lcov libboost-dev libxml2 libxml2-dev pkg-config zlib1g-dev
6565
- apt-get install -y firefox-esr --no-install-recommends
6666
script:
6767
# build and run tests

code/html_generation.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include "html_generation.hpp"
2222
#include <fstream>
2323
#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>
2427
#include "browser_detection.hpp"
2528
#include "Config.hpp"
2629
#include "paths.hpp"
@@ -64,15 +67,14 @@ void openFirstIndexFile(const FolderMap& fm, const std::string& html_dir)
6467
<< "Info: Open " << fullFileName << " in a browser to see the generated HTML files.\n";
6568
return;
6669
}
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();
7678
}
7779

7880
int generateHtmlFiles(const MessageDatabase& mdb, const FolderMap& fm, const HTMLOptions htmlOptions)

0 commit comments

Comments
 (0)