gyscos / gyscos/cursive

Pause Cursive program and pass stdin and stdout to subprocess

Open
#199 26 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
270
Avg merge
5d 19h
Merged PRs (30d)
2

Description

I am new to Rust and this library so I'm not sure if this is currently possible.

# Problem description

I'm trying to make a Cursive program that will launch another interactive program and then resume after the program exits. I'm using the Termion backend. I have tried this on the callback of a submit:

```rust
Command::new("w3m")
.args(&["http://google.com"])
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.output().unwrap();
```

But it seems like Cursive in the background is still reacting to the stdin and the spawned program isn't working correctly (I have to hit tab multiple times before w3m responds and goes to the next link, there's no cursor, etc.). If I run that code above in a fresh main.rs without Cursive, the spawned program behaves fine.

[blessed, a terminal UI library in Node.js has a function for this called spawn](https://github.com/chjj/blessed/blob/eab243fc7ad27f1d2932db6134f7382825ee3488/lib/widgets/screen.js#L1739).

The cursor would have to be shown again and Cursive would need to stop processing stdin until the spawned program closes.

# Environment

* Operating system: linux Ubuntu 16.04
* Backend used: Termion
* Current locale (run `locale` in a terminal): en_US.UTF-8
* Cursive version (from crates.io, from git, ...): crates.io 0.7.5

Thanks for creating this library. I've been able to get a lot done with it so far!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.