diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5d53d2f3..e97e28a3 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,9 +32,16 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + include: + - os: ubuntu-latest + cc: clang + cxx: clang++ + - os: macOS-latest + - os: windows-latest runs-on: ${{ matrix.os }} - + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} steps: - uses: actions/checkout@v2 diff --git a/Fleece/Support/Backtrace+capture-posix.cc b/Fleece/Support/Backtrace+capture-posix.cc index 6b2022e1..775628af 100644 --- a/Fleece/Support/Backtrace+capture-posix.cc +++ b/Fleece/Support/Backtrace+capture-posix.cc @@ -199,7 +199,8 @@ namespace signal_safe { #endif if ( fd != -1 ) write(fd, str, n ? n : strlen(str)); - write(STDERR_FILENO, str, n ? n : strlen(str)); + if (getenv("CBL_BACKTRACE_TO_STDERR") != nullptr) + write(STDERR_FILENO, str, n ? n : strlen(str)); #ifdef __clang__ # pragma clang diagnostic pop diff --git a/Tests/SupportTests.cc b/Tests/SupportTests.cc index a27f368b..c1e3ccb4 100644 --- a/Tests/SupportTests.cc +++ b/Tests/SupportTests.cc @@ -409,6 +409,11 @@ namespace test::backtrace { TEST_CASE("Backtrace crash", "[.BacktraceManual]") { // Since this test crashes the process intentionally, // It will fail and require manual inspection of stderr +#ifdef _MSC_VER + SetEnvironmentVariable("CBL_BACKTRACE_TO_STDERR", "1"); +#else + setenv("CBL_BACKTRACE_TO_STDERR", "1", 1); +#endif test::backtrace::crashOnPurpose(); }