expectrl icon indicating copy to clipboard operation
expectrl copied to clipboard

Doesn't work on Windows in GitHub Actions

Open jwodder opened this issue 3 years ago • 6 comments

Consider the following very simple use of expectrl:

use expectrl::{spawn, Error};
use std::time::Duration;

fn main() -> Result<(), Error> {
    println!("Spawning ...");
    let mut p = spawn("cat")?;
    p.set_expect_timeout(Some(Duration::from_secs(3)));
    println!("Sending line ...");
    p.send_line("Hello World")?;
    println!("Expecting line ...");
    p.expect("Hello World")?;
    println!("OK!");
    Ok(())
}

If this program is run in GitHub Actions (using expectrl 0.6.0 and Rust 1.65.0), it succeeds on Ubuntu and macOS but fails on Windows; you can see such a run here. In particular, the output on Windows is:

Spawning ...
Sending line ...
Expecting line ...
Error: ExpectTimeout

jwodder avatar Nov 30 '22 01:11 jwodder

Hi @jwodder

Thanks for report.

As I remember I've encountered some issues with windows CI as well. But I didn't figure it out.

It might be something related to CI container/host itself.

zhiburt avatar Nov 30 '22 10:11 zhiburt

But I'll run it myself maybe something was changed after all.

zhiburt avatar Nov 30 '22 10:11 zhiburt

Actually, you know it might be a bug.

zhiburt avatar Nov 30 '22 17:11 zhiburt

But wait.... there's no cat on windows.

To be precise it's a different program.

image

zhiburt avatar Nov 30 '22 17:11 zhiburt

@zhiburt Well, this was just an attempt at an MVCE. Trying to use expectrl with my actual (complicated) program still fails under Windows. What Windows program would you recommend for an MVCE?

jwodder avatar Nov 30 '22 17:11 jwodder

Hi @jwodder

Sorry that it was ignored for such a long time.

What Windows program would you recommend for an MVCE?

So I was playing with appveyor and github actions and neither of them "works". I am not sure why still.....

I found out that both of them have a limited package of programs so I've tested custom python scripts. And they both don't work.

So far it's still unclear why it fails. I guess it might be some windows settings (e.g. I am not sure whether conpty requires some tweak inside windows settings)

https://ci.appveyor.com/project/zhiburt/expectrl-1oa5l/builds/46457768#L319 https://github.com/zhiburt/expectrl/actions/runs/4376327509/jobs/7658275779#step:8:82

zhiburt avatar Mar 28 '23 16:03 zhiburt