Skip to content

Commit

Permalink
Disable log grouping when --message-format option is used
Browse files Browse the repository at this point in the history
Fixes #221
  • Loading branch information
taiki-e committed Sep 15, 2023
1 parent 4fe0b35 commit 35a3fa8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
cargo install --path . --debug
cd tests/fixtures/real
cargo hack check --feature-powerset --workspace
cargo hack check --feature-powerset --workspace --message-format=json
cd ../rust-version
rustup toolchain remove 1.63 1.64 1.65
cargo hack check --rust-version --workspace
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Disable log grouping on GitHub Actions by default if an option is passed in which stdout is assumed to be used, such as `--message-format`. ([#221](https://github.com/taiki-e/cargo-hack/pull/221))

## [0.6.7] - 2023-09-11

- Group rustup output on GitHub Actions. ([#219](https://github.com/taiki-e/cargo-hack/pull/219))
Expand Down
6 changes: 6 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ impl Args {
let mut version_range = None;
let mut version_step = None;
let mut log_group: Option<String> = None;
let mut disable_log_grouping = false;

let mut optional_deps = None;
let mut include_features = vec![];
Expand Down Expand Up @@ -328,6 +329,10 @@ impl Args {
Long(flag) => {
removed_flags(flag)?;
similar_flags(flag, subcommand.as_deref())?;
if matches!(flag, "message-format") {
// https://github.com/taiki-e/cargo-hack/issues/221
disable_log_grouping = true;
}
let flag = format!("--{flag}");
if let Some(val) = parser.optional_value() {
cargo_args.push(format!("{flag}={}", val.string()?));
Expand Down Expand Up @@ -550,6 +555,7 @@ impl Args {

let log_group = match log_group {
Some(v) => v.parse()?,
None if disable_log_grouping => LogGroup::None,
None => LogGroup::auto(),
};

Expand Down

0 comments on commit 35a3fa8

Please sign in to comment.