Do not issue ANSI escapes if stdout is not connected to terminal
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
### Describe the bug
When invoking commands like `aws s3 cp` from scripts, the program issues ANSI sequences like the one for the progress notification (i.e. move cursor back to start of line). If these scripts not log their output to a file they instead result in a jumbled mess which is hard to read
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Expected Behavior
If stdout/stderr is not connected to a terminal the CLI should either a) automatically infer `--no-progress`, or b) write each progress update on a new line
### Current Behavior

The `^M` is how `less` represents these ANSI escapes
### Reproduction Steps
`aws s3 cp ./foo s3://bar/ >log.txt`
### Possible Solution
This can be somewhat mitigated by explicitly using `--no-progress` but doing so obviously hides any progress
### Additional Information/Context
_No response_
### CLI version used
awscli2-2.25.0
### Environment details (OS name and version, etc.)
Fedora 42
Contributor guide
Assessment
This issue has not been assessed yet.