From 8ed1e472b72b739bd852d2b9a2d688b3da015cf5 Mon Sep 17 00:00:00 2001 From: laniakea64 Date: Mon, 2 Sep 2024 12:10:37 -0400 Subject: [PATCH] tests: move workaround for "Press ENTER or type command to continue" to test runner --- tests/batch_ftdetect_res.vim | 3 --- tests/src/common.rs | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/batch_ftdetect_res.vim b/tests/batch_ftdetect_res.vim index a16439f..3134233 100644 --- a/tests/batch_ftdetect_res.vim +++ b/tests/batch_ftdetect_res.vim @@ -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("\") - qa diff --git a/tests/src/common.rs b/tests/src/common.rs index 2287902..5c2c6bd 100644 --- a/tests/src/common.rs +++ b/tests/src/common.rs @@ -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}, @@ -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) {