Skip to content

Commit

Permalink
fix: use cursors for windows support in directory_untracked_less
Browse files Browse the repository at this point in the history
  • Loading branch information
brigand committed Jun 2, 2021
1 parent b16196b commit 4fddb73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/git.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::env::current_dir;
use std::ffi::OsStr;
use std::fmt;
use std::io::Cursor;
use std::io::Read;
use std::io::{self, BufRead, BufReader};
use std::os::unix::prelude::OsStrExt;
Expand Down Expand Up @@ -184,8 +185,10 @@ impl Git {
let mut stdin = less.stdin.take().expect("Failed to open stdin");
spawn(move || {
let suffix = "\n= End =\n";
let prefix = prefix.into_bytes();
let mut input = prefix.chain(ls_stdout).chain(suffix.as_bytes());
let prefix = Cursor::new(prefix);

let mut input = prefix.chain(ls_stdout).chain(Cursor::new(suffix));

let _r = io::copy(&mut input, &mut stdin);
});

Expand Down

0 comments on commit 4fddb73

Please sign in to comment.