mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
Merge pull request #649 from jbcrail/fix-stdbuf-regression
Fix stdbuf regression.
This commit is contained in:
commit
7c2ed679ab
3 changed files with 18 additions and 1 deletions
1
Makefile
1
Makefile
|
@ -185,6 +185,7 @@ TEST_PROGS := \
|
|||
seq \
|
||||
sort \
|
||||
split \
|
||||
stdbuf \
|
||||
tac \
|
||||
test \
|
||||
tr \
|
||||
|
|
|
@ -225,7 +225,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
|
||||
let mut options = ProgramOptions {stdin: BufferType::Default, stdout: BufferType::Default, stderr: BufferType::Default};
|
||||
let mut command_idx = -1;
|
||||
for i in 1 .. args.len()-1 {
|
||||
for i in 1 .. args.len()+1 {
|
||||
match parse_options(&args[1 .. i], &mut options, &opts) {
|
||||
Ok(OkMsg::Buffering) => {
|
||||
command_idx = i - 1;
|
||||
|
|
16
test/stdbuf.rs
Normal file
16
test/stdbuf.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use std::process::Command;
|
||||
use util::*;
|
||||
|
||||
static PROGNAME: &'static str = "./stdbuf";
|
||||
|
||||
#[path = "common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
#[test]
|
||||
fn test_stdbuf_unbuffered_stdout() {
|
||||
// This is a basic smoke test
|
||||
let mut cmd = Command::new(PROGNAME);
|
||||
let result = run_piped_stdin(&mut cmd.args(&["-o0", "head"]), "The quick brown fox jumps over the lazy dog.");
|
||||
assert_eq!(result.stdout, "The quick brown fox jumps over the lazy dog.");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue