Skip to content

Commit c7734a9

Browse files
committed
[SMCE] Explicitly disable consoles on Windows subprocesses
Signed-off-by: AeroStun <24841307+AeroStun@users.noreply.github.com>
1 parent 963ca8a commit c7734a9

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/SMCE/Board.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <csignal>
2424
#elif BOOST_OS_WINDOWS
2525
#define WIN32_LEAN_AND_MEAN
26+
#include <boost/process/windows.hpp>
2627
#include <Windows.h>
2728
#include <winternl.h>
2829
#pragma comment(lib, "ntdll.lib")
@@ -44,7 +45,6 @@ extern "C" {
4445
#include <type_traits>
4546
#endif
4647

47-
#include <ctime>
4848
#include <string>
4949
#include <SMCE/BoardConf.hpp>
5050
#include <SMCE/BoardView.hpp>
@@ -225,6 +225,9 @@ void Board::do_spawn() noexcept {
225225
"\""+m_sketch_ptr->m_executable.string()+"\"",
226226
bp::std_out > bp::null,
227227
bp::std_err > m_internal->sketch_log
228+
#if BOOST_OS_WINDOWS
229+
,bp::windows::create_no_window
230+
#endif
228231
);
229232

230233
m_internal->sketch_log_grabber = std::thread{[&]{

src/SMCE/Toolchain.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
#include <string>
2222
#include <system_error>
23+
#include <boost/predef.h>
2324
#include <boost/process.hpp>
25+
#if BOOST_OS_WINDOWS
26+
#include <boost/process/windows.hpp>
27+
#endif
2428
#include <SMCE/internal/utils.hpp>
2529
#include <SMCE/Sketch.hpp>
2630
#include <SMCE/SketchConf.hpp>
@@ -164,6 +168,9 @@ std::error_code Toolchain::do_configure(Sketch& sketch) noexcept {
164168
"-P",
165169
m_res_dir.string() + "/RtResources/SMCE/share/Scripts/ConfigureSketch.cmake",
166170
(bp::std_out & bp::std_err) > cmake_conf_out
171+
#if BOOST_OS_WINDOWS
172+
,bp::windows::create_no_window
173+
#endif
167174
);
168175

169176
{
@@ -206,6 +213,9 @@ std::error_code Toolchain::do_build(Sketch& sketch) noexcept {
206213
"--build", (sketch.m_tmpdir / "build").string(),
207214
"--config", "Release",
208215
(bp::std_out & bp::std_err) > cmake_build_out
216+
#if BOOST_OS_WINDOWS
217+
,bp::windows::create_no_window
218+
#endif
209219
};
210220

211221
for (std::string line; std::getline(cmake_build_out, line);) {
@@ -253,7 +263,14 @@ std::error_code Toolchain::do_build(Sketch& sketch) noexcept {
253263
return toolchain_error::cmake_not_found;
254264
}
255265
bp::ipstream cmake_out;
256-
bp::child cmake_child{m_cmake_path, "--version", bp::std_out > cmake_out};
266+
bp::child cmake_child{
267+
m_cmake_path,
268+
"--version",
269+
bp::std_out > cmake_out
270+
#if BOOST_OS_WINDOWS
271+
,bp::windows::create_no_window
272+
#endif
273+
};
257274
std::string line;
258275
while (cmake_child.running() && std::getline(cmake_out, line) && !line.empty()) {
259276
if(!line.starts_with("cmake")) {

0 commit comments

Comments
 (0)