Description
When component builds fail during development mode, the error output doesn't include color formatting. This makes it harder to read and parse error messages compared to running builds directly.
Location
crates/wash/src/cli/dev.rs:345 in the rebuild error handling
Current Behavior
Err(e) => {
info!("failed to build component, will retry on next file change");
// TODO(GFI): This doesn't include color output
// This nicely formats the error message
error!("{e}");
// ...
}
The error output lacks color formatting that would normally be present when running build tools directly.
Proposed Solution
Preserve color formatting in error output:
- Capture colored output: Ensure build processes preserve terminal color codes
- Pass through colors: Don't strip ANSI color codes when displaying errors
- Terminal detection: Respect user's color preferences and terminal capabilities
Example Implementation
Err(e) => {
info!("failed to build component, will retry on next file change");
// Preserve color output if terminal supports it
if atty::is(atty::Stream::Stderr) {
// Display with colors preserved
eprintln!("{}", e);
} else {
// Fallback to plain text for non-terminals
error!("{e}");
}
// ...
}
Benefits
- Better readability: Color-coded errors are easier to scan and understand
- Consistent experience: Matches what users see when running builds directly
- Error highlighting: Syntax errors, warnings, and suggestions are properly highlighted
Implementation Notes
- Should respect
NO_COLOR environment variable
- Consider using
termcolor or similar crate for cross-platform support
- May need to configure build tools to output colors even when not in TTY mode
Description
When component builds fail during development mode, the error output doesn't include color formatting. This makes it harder to read and parse error messages compared to running builds directly.
Location
crates/wash/src/cli/dev.rs:345in the rebuild error handlingCurrent Behavior
The error output lacks color formatting that would normally be present when running build tools directly.
Proposed Solution
Preserve color formatting in error output:
Example Implementation
Benefits
Implementation Notes
NO_COLORenvironment variabletermcoloror similar crate for cross-platform support