From b2fe4053655b59387eb5b7c8095c8385c569beee Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 12 Jan 2025 13:43:51 +0100 Subject: [PATCH] Revert "fish_indent: Correctly read from builtin stdin" Using Arguments here breaks the `command fish_indent` case. Probably needs to directly use a BufReader. This reverts commit ab1b6bcea587577d2f855bfa6f3ea86b5345a74c. --- src/builtins/fish_indent.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/builtins/fish_indent.rs b/src/builtins/fish_indent.rs index 683d4a5a5..e65938421 100644 --- a/src/builtins/fish_indent.rs +++ b/src/builtins/fish_indent.rs @@ -8,7 +8,7 @@ use std::ffi::{CString, OsStr}; use std::fs; -use std::io::{Read, Write}; +use std::io::{stdin, Read, Write}; use std::os::unix::ffi::OsStrExt; use crate::panic::panic_handler; @@ -848,16 +848,10 @@ fn do_indent(streams: &mut IoStreams, args: Vec) -> i32 { )); return STATUS_CMD_ERROR.unwrap(); } - let mut zero = 0; - let buf = Vec::with_capacity(1024); - let mut expression = WString::new(); - for (arg, _) in Arguments::new(&buf, &mut zero, streams, 1024) { - if !expression.is_empty() { - expression.push('\n') - } - expression.push_utfstr(&arg); + match read_file(stdin()) { + Ok(s) => src = s, + Err(()) => return STATUS_CMD_ERROR.unwrap(), } - src = expression; } else { let arg = args[i]; match fs::File::open(OsStr::from_bytes(&wcs2string(arg))) {