Skip to content

Commit 790ba0e

Browse files
committed
fix: repair POSIX build and unpin the CI Visual Studio generator
process_posix.cpp: Process::wait_for was defined inside Process::wait(), before that function's trailing throw, so every POSIX build failed with "function definition is not allowed here". This translation unit is not compiled on Windows, which is why it went unnoticed. Move wait_for out to file scope. ci.yml: drop the hardcoded -G "Visual Studio 17 2022". The windows-latest runner image no longer ships that toolchain ("could not find any instance of Visual Studio"), failing the Windows job at configure regardless of the code. CMake's per-platform default generator is correct on all three runners.
1 parent 616d4a0 commit 790ba0e

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, windows-latest, macos-latest]
15-
include:
16-
- os: ubuntu-latest
17-
cmake_generator: "Unix Makefiles"
18-
- os: windows-latest
19-
cmake_generator: "Visual Studio 17 2022"
20-
- os: macos-latest
21-
cmake_generator: "Unix Makefiles"
2215

2316
runs-on: ${{ matrix.os }}
2417

2518
steps:
2619
- uses: actions/checkout@v4
2720

2821
- name: Configure CMake
29-
run: cmake -B build -G "${{ matrix.cmake_generator }}" -DCMAKE_BUILD_TYPE=Release -DCOPILOT_BUILD_TESTS=ON
22+
# Deliberately no -G: runner images rotate their Visual Studio version, and pinning
23+
# one ("Visual Studio 17 2022") breaks the Windows job the moment the image moves on.
24+
# CMake's per-platform default is correct on all three runners.
25+
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCOPILOT_BUILD_TESTS=ON
3026

3127
- name: Build
3228
run: cmake --build build --config Release

‎src/process_posix.cpp‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -587,21 +587,21 @@ int Process::wait()
587587
return handle_->exit_code;
588588
}
589589

590-
std::optional<int> Process::wait_for(std::chrono::milliseconds timeout)
591-
{
592-
const auto deadline = std::chrono::steady_clock::now() + timeout;
593-
do
594-
{
595-
if (auto result = try_wait())
596-
return result;
597-
std::this_thread::sleep_for(std::chrono::milliseconds(10));
598-
} while (std::chrono::steady_clock::now() < deadline);
599-
return std::nullopt;
600-
}
601-
602590
throw ProcessError("waitpid failed: " + get_errno_message());
603591
}
604592

593+
std::optional<int> Process::wait_for(std::chrono::milliseconds timeout)
594+
{
595+
const auto deadline = std::chrono::steady_clock::now() + timeout;
596+
do
597+
{
598+
if (auto result = try_wait())
599+
return result;
600+
std::this_thread::sleep_for(std::chrono::milliseconds(10));
601+
} while (std::chrono::steady_clock::now() < deadline);
602+
return std::nullopt;
603+
}
604+
605605
void Process::terminate()
606606
{
607607
if (handle_ && handle_->pid > 0 && handle_->running)

0 commit comments

Comments
 (0)