mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
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 ab1b6bcea5
.
This commit is contained in:
parent
ab1b6bcea5
commit
b2fe405365
1 changed files with 4 additions and 10 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
use std::ffi::{CString, OsStr};
|
use std::ffi::{CString, OsStr};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{Read, Write};
|
use std::io::{stdin, Read, Write};
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
|
||||||
use crate::panic::panic_handler;
|
use crate::panic::panic_handler;
|
||||||
|
@ -848,16 +848,10 @@ fn do_indent(streams: &mut IoStreams, args: Vec<WString>) -> i32 {
|
||||||
));
|
));
|
||||||
return STATUS_CMD_ERROR.unwrap();
|
return STATUS_CMD_ERROR.unwrap();
|
||||||
}
|
}
|
||||||
let mut zero = 0;
|
match read_file(stdin()) {
|
||||||
let buf = Vec::with_capacity(1024);
|
Ok(s) => src = s,
|
||||||
let mut expression = WString::new();
|
Err(()) => return STATUS_CMD_ERROR.unwrap(),
|
||||||
for (arg, _) in Arguments::new(&buf, &mut zero, streams, 1024) {
|
|
||||||
if !expression.is_empty() {
|
|
||||||
expression.push('\n')
|
|
||||||
}
|
|
||||||
expression.push_utfstr(&arg);
|
|
||||||
}
|
}
|
||||||
src = expression;
|
|
||||||
} else {
|
} else {
|
||||||
let arg = args[i];
|
let arg = args[i];
|
||||||
match fs::File::open(OsStr::from_bytes(&wcs2string(arg))) {
|
match fs::File::open(OsStr::from_bytes(&wcs2string(arg))) {
|
||||||
|
|
Loading…
Reference in a new issue