Compare commits

...

21 Commits

Author SHA1 Message Date
John DeBoard a28d961bc0
Merge b05cde7ab4 into b4e3a84e1a 2024-05-01 05:26:28 +01:00
dependabot[bot] b4e3a84e1a
Bump serde from 1.0.197 to 1.0.199 (#2953)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.197 to 1.0.199.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.197...v1.0.199)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-01 03:23:25 +00:00
dependabot[bot] f7c39e8353
Bump os_str_bytes from 6.6.1 to 7.0.0 (#2952)
Bumps [os_str_bytes](https://github.com/dylni/os_str_bytes) from 6.6.1 to 7.0.0.
- [Release notes](https://github.com/dylni/os_str_bytes/releases)
- [Commits](https://github.com/dylni/os_str_bytes/compare/6.6.1...7.0.0)

---
updated-dependencies:
- dependency-name: os_str_bytes
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-01 03:10:09 +00:00
dependabot[bot] 37d9f0533c
Bump indexmap from 2.2.2 to 2.2.6 (#2950)
Bumps [indexmap](https://github.com/indexmap-rs/indexmap) from 2.2.2 to 2.2.6.
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.2...2.2.6)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-01 02:47:11 +00:00
dependabot[bot] d560f2a515
Bump serde_with from 3.7.0 to 3.8.1 (#2949)
Bumps [serde_with](https://github.com/jonasbb/serde_with) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: serde_with
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-01 02:27:04 +00:00
John DeBoard b05cde7ab4
Merge branch 'master' into issue#2561 2024-02-02 09:19:02 -05:00
deboard 2a29029828 Merge branch 'issue#2561' of github.com:deboard/bat into issue#2561 2024-01-22 20:23:35 -05:00
deboard ac4f4b40df Ran cargo fmt. 2024-01-22 20:23:20 -05:00
John DeBoard b1819cb09d
Merge branch 'master' into issue#2561 2024-01-22 20:10:41 -05:00
deboard 10fd0b70e5 Add integration test. 2024-01-22 20:06:41 -05:00
deboard ed6aad7835 Add test. 2024-01-05 23:20:47 -05:00
John DeBoard e5858e27d9
Merge branch 'master' into issue#2561 2024-01-04 10:04:36 -05:00
deboard 1f3e3e0d71 Ammend CHANGELOG... Again... 2024-01-03 05:38:53 -05:00
deboard 635175ea64 Ammend CHANGELOG... Again... 2024-01-03 05:37:56 -05:00
deboard 7ae3185f47 Merge branch 'issue#2561' of github.com:deboard/bat into issue#2561 2024-01-02 19:09:10 -05:00
deboard cb2f8f8210 Ammend CHANGELOG... Again 2024-01-02 19:08:16 -05:00
deboard 76a655da5f Merge branch 'issue#2561' of github.com:deboard/bat into issue#2561 2024-01-02 19:03:02 -05:00
deboard 6a0f6beab6 Ammend CHANGELOG 2024-01-02 19:02:26 -05:00
deboard 6b90c21ba3 Merge branch 'issue#2561' of github.com:deboard/bat into issue#2561 2024-01-02 18:01:34 -05:00
deboard 6ea3ac71d7 issue 2561, send all [bat error]s to stderr in default_error_handler
match default.
2024-01-02 17:54:49 -05:00
deboard 54cec4a8e0 issue 2561, send all [bat error]s to stderr in default_error_handler
match default.
2024-01-02 17:44:27 -05:00
6 changed files with 54 additions and 16 deletions

View File

@ -10,7 +10,10 @@
## Bugfixes
- Send all bat error messages to stderr, see #2827 (@deboard)
- Fix long file name wrapping in header, see #2835 (@FilipRazek)
-
- Fix `NO_COLOR` support, see #2767 (@acuteenvy)
- Fix handling of inputs with OSC ANSI escape sequences, see #2541 and #2544 (@eth-p)
- Fix handling of inputs with combined ANSI color and attribute sequences, see #2185 and #2856 (@eth-p)

24
Cargo.lock generated
View File

@ -647,9 +647,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.2.2"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown 0.14.1",
@ -839,9 +839,9 @@ dependencies = [
[[package]]
name = "os_str_bytes"
version = "6.6.1"
version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
checksum = "7ac44c994af577c799b1b4bd80dc214701e349873ad894d6cdf96f4f7526e0b9"
dependencies = [
"memchr",
]
@ -1116,18 +1116,18 @@ checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
[[package]]
name = "serde"
version = "1.0.197"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.197"
version = "1.0.199"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
dependencies = [
"proc-macro2",
"quote",
@ -1156,9 +1156,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "3.7.0"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a"
checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20"
dependencies = [
"serde",
"serde_derive",
@ -1167,9 +1167,9 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "3.7.0"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655"
checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2"
dependencies = [
"darling",
"proc-macro2",

View File

@ -66,7 +66,7 @@ regex = { version = "1.10.2", optional = true }
walkdir = { version = "2.4", optional = true }
bytesize = { version = "1.3.0" }
encoding_rs = "0.8.33"
os_str_bytes = { version = "~6.6", optional = true }
os_str_bytes = { version = "~7.0", optional = true }
run_script = { version = "^0.10.1", optional = true}
[dependencies.git2]
@ -102,13 +102,13 @@ nix = { version = "0.26.4", default-features = false, features = ["term"] }
[build-dependencies]
anyhow = "1.0.78"
indexmap = { version = "2.2.2", features = ["serde"] }
indexmap = { version = "2.2.6", features = ["serde"] }
itertools = "0.12.1"
once_cell = "1.18"
regex = "1.10.2"
serde = "1.0"
serde_derive = "1.0"
serde_with = { version = "3.7.0", default-features = false, features = ["macros"] }
serde_with = { version = "3.8.1", default-features = false, features = ["macros"] }
toml = { version = "0.8.9", features = ["preserve_order"] }
walkdir = "2.4"

View File

@ -67,7 +67,15 @@ pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
.ok();
}
_ => {
writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
// default - always write [bat error] to stderr
let stderr = std::io::stderr();
writeln!(
&mut stderr.lock(),
"{}: {}",
Red.paint("[bat error]"),
error
)
.ok();
}
};
}

View File

@ -847,6 +847,16 @@ fn env_var_bat_pager_value_bat() {
.stderr(predicate::str::contains("bat as a pager is disallowed"));
}
#[test]
fn bat_error_to_stderr() {
bat()
.env("BAT_PAGER", "bat")
.arg("/tmp")
.assert()
.failure()
.stderr(predicate::str::contains("[bat error]"));
}
#[test]
fn pager_value_bat() {
bat()
@ -1319,6 +1329,9 @@ fn can_print_file_starting_with_cache() {
.stderr("");
}
#[test]
fn send_all_bat_error_to_stderr() {}
#[test]
fn does_not_print_unwanted_file_named_cache() {
bat_with_config().arg("cach").assert().failure();

14
tests/scripts/stderr1.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
## test for issue 2561
OUTPUT=$(mktemp)
BAT=bat
code=$($BAT /tmp 2> $OUTPUT; cat $OUTPUT | grep error; echo $?)
if [[ $code == 1 ]]; then
echo "stderr test fsil"
exit 1
fi
exit 0