-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Request for Enhancement: Proper Exit Code Propagation
Problem
Currently, mvx custom commands do not properly propagate exit codes from the underlying scripts to the calling process. This makes it impossible to use mvx commands in CI/CD pipelines or scripts that depend on exit codes for flow control.
Current Behavior
When a custom command's script fails or returns a non-zero exit code, mvx may not propagate this exit code correctly to the shell, making it appear as if the command succeeded when it actually failed.
Expected Behavior
Mvx should:
- Capture the exit code from the executed script
- Propagate the exit code to the calling process
- Maintain consistency with standard Unix tool behavior
Use Cases
CI/CD Pipeline Integration
# This should fail the CI build if formatting is needed
./mvx format-check
if [ $? -ne 0 ]; then
echo "Code formatting required"
exit 1
fiScript Flow Control
# This should work for conditional logic
if ./mvx lint; then
echo "Linting passed"
else
echo "Linting failed"
exit 1
fiMake Integration
# This should fail the make target if the command fails
format-check:
./mvx format-check
lint:
./mvx lint
.PHONY: format-check lintCurrent Workaround
Users must manually check command output or use direct tool invocation:
# Instead of relying on exit codes
output=$(./mvx format-check)
if [ -n "$output" ]; then
echo "Format check failed: $output"
exit 1
fiTechnical Requirements
- Exit Code Preservation: The mvx process should exit with the same code as the underlying script
- Error Handling: Distinguish between script failures and mvx internal errors
- Consistency: All custom commands should behave consistently with exit code propagation
- Backward Compatibility: Existing commands should continue to work as expected
Related Issues
- This is related to [RFE] Enhanced script syntax support for custom commands #52 (Enhanced script syntax support) as both are needed for robust CI integration
- This affects all custom commands, not just specific tools
Priority
High - This is essential for proper CI/CD integration and makes mvx commands behave like standard Unix tools that respect exit codes.
Metadata
Metadata
Assignees
Labels
No labels