Closed
Conversation
Co-authored-by: wolfv <885054+wolfv@users.noreply.github.com>
Co-authored-by: wolfv <885054+wolfv@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Test exit codes aren't checked on Windows
Fix Windows test exit codes not being checked
Jul 25, 2025
wolfv
requested changes
Jul 25, 2025
| // - empty lines and whitespace-only lines | ||
| // - comment lines (@rem, rem, ::) | ||
| // - label lines (starting with :) | ||
| let should_add_check = i < lines.len() - 1 |
Member
There was a problem hiding this comment.
What about line continuation with ^?
Contributor
Author
There was a problem hiding this comment.
Line continuation with ^ is already handled! The code detects lines ending with ^ (line 67), tracks continuation state (lines 82-88), and only adds exit code checks after the complete command finishes (lines 95-98). See tests test_add_exit_code_checks_with_line_continuation() and related tests at lines 276-310 for verification.
Co-authored-by: wolfv <885054+wolfv@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where test scripts with multiple commands on Windows would ignore failures in earlier commands, only checking the exit code of the final command. This behavior was inconsistent with conda-build and could lead to packages passing tests when they should fail.
Problem
When running test scripts on Windows with multiple commands like:
The test phase would succeed even if the import command failed, because only the last command's exit code was checked.
Solution
Added Windows-specific exit code checking to the
CmdExeInterpreterthat insertsIF %ERRORLEVEL% NEQ 0 EXIT 1after each command (except the last), mimicking conda-build's proven approach:Now if any command fails, the script immediately exits with error code 1.
Changes
CmdExeInterpreter::add_exit_code_checks()method that intelligently processes Windows batch scriptsCmdExeInterpreter::run()andOutput::create_build_script()methods@rem,::, etc.), labels (:label), and empty linesVerification
The fix has been thoroughly tested with scenarios including:
All existing tests continue to pass, ensuring no breaking changes.
Fixes #1792.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.