mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
Merge branch 'main' into refactor-world-renderer
This commit is contained in:
commit
a8886bccfb
18 changed files with 404 additions and 118 deletions
|
|
@ -82,6 +82,10 @@ static bool perform_keyword(
|
|||
params.subProcessDepth = reader.nextInt();
|
||||
return true;
|
||||
}, "<depth>", "sub-process depth"),
|
||||
ArgC("--log", [](auto& params, auto& reader) -> bool {
|
||||
params.logFile = reader.next();
|
||||
return true;
|
||||
}, "<file>", "target log file"),
|
||||
ArgC("--help", [](auto&, auto&) -> bool {
|
||||
std::cout << "VoxelCore v" << ENGINE_VERSION_STRING << "\n\n";
|
||||
std::cout << "Command-line arguments:\n";
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace platform::internal {
|
||||
std::filesystem::path get_executable_path();
|
||||
}
|
||||
|
|
@ -356,7 +358,7 @@ std::unique_ptr<Process> platform::new_engine_instance(
|
|||
if (!outputFile.empty()) {
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
si.hStdOutput = CreateFileW(
|
||||
toWString(outputFile.u8string()).data(),
|
||||
toWString(outputFile.empty() ? outputFile.u8string() : "NUL"s).data(),
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE | FILE_SHARE_READ,
|
||||
nullptr,
|
||||
|
|
@ -434,9 +436,12 @@ std::unique_ptr<Process> platform::new_engine_instance(
|
|||
if (subProcess) {
|
||||
pid_t pid = fork();
|
||||
|
||||
if (outputFile.empty()) {
|
||||
outputFile = "/dev/null";
|
||||
}
|
||||
int fd = open(
|
||||
outputFile.string().c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0644
|
||||
);
|
||||
);
|
||||
|
||||
if (pid == 0) {
|
||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue