Skip to content

Commit

Permalink
tests: move workaround for "Press ENTER or type command to continue" …
Browse files Browse the repository at this point in the history
…to test runner
  • Loading branch information
laniakea64 committed Sep 2, 2024
1 parent 3325db6 commit 8ed1e47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions tests/batch_ftdetect_res.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ set nomore

bufdo redir >> $OUTPUT | echo @% | set ft? | redir END

" Prevent stalling on 'Press ENTER or type command to continue'
call feedkeys("\<CR>")

qa
8 changes: 6 additions & 2 deletions tests/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{
env,
ffi::OsString,
fs::canonicalize,
io::{self, ErrorKind},
io::{self, prelude::*, ErrorKind},
os::unix::fs as ufs,
path::{Path, PathBuf},
process::{Command, Stdio},
Expand Down Expand Up @@ -76,12 +76,16 @@ pub fn run_vim(
.env("HOME", home)
.env("XDG_CONFIG_HOME", home)
.env("XDG_DATA_HOME", home)
.stdin(Stdio::null())
.stdin(Stdio::piped())
.stdout(Stdio::null())
.stderr(Stdio::piped())
.spawn()
.unwrap();

let mut vim_stdin = vim.stdin.take().unwrap();
// Prevent stalling on "Press ENTER or type command to continue"
vim_stdin.write_all(b"\r")?;

let status = loop {
let poll_interval = Duration::from_millis(200);
match vim.wait_timeout(poll_interval) {
Expand Down

0 comments on commit 8ed1e47

Please sign in to comment.