Skip to content

Commit d3154e4

Browse files
author
Kasper Peeters
committed
Output stdout and stderr to log file on Windows in attempt to debug ARM64 build.
1 parent e1ed49b commit d3154e4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.github/workflows/windows.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ jobs:
131131
test:
132132
needs: msys2-ucrt64
133133
strategy:
134+
fail-fast: false
134135
matrix:
135136
include:
136137
- os: windows-2022
@@ -202,6 +203,13 @@ jobs:
202203
# Cleanup
203204
Stop-Process -Id $process.Id -Force
204205
206+
- name: Upload cadabra_log.txt
207+
if: always()
208+
uses: actions/upload-artifact@v4
209+
with:
210+
name: cadabra_log-${{ matrix.os }}.txt
211+
path: C:\Windows\Temp\cadabra_log.txt
212+
205213
- name: Upload screenshot
206214
uses: actions/upload-artifact@v4
207215
with:

frontend/gtkmm/main.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@
2121
int main(int argc, char **argv)
2222
{
2323
#ifdef _WIN32
24-
// Disable console creation
24+
// We are going to disable console creation. However,
25+
// that also kills any output to stdout or stderr, which may
26+
// have been useful in case of missing dlls or other errors.
27+
// Write them to a log file.
28+
std::ofstream logFile("C:\\Windows\\Temp\\cadabra_log.txt");
29+
std::streambuf* oldCout = std::cout.rdbuf(logFile.rdbuf());
30+
std::streambuf* oldCerr = std::cerr.rdbuf(logFile.rdbuf());
31+
2532
FreeConsole();
2633
#endif
2734

@@ -37,6 +44,11 @@ int main(int argc, char **argv)
3744
catch (std::exception& ex) {
3845
std::cerr << ex.what() << std::endl;
3946
}
47+
48+
#ifdef _WIN32
49+
std::cout.rdbuf(oldCout);
50+
std::cerr.rdbuf(oldCerr);
51+
#endif
4052
}
4153

4254
// #if defined(_WIN32) && defined(NDEBUG)

0 commit comments

Comments
 (0)