Skip to content

Panics when a CLI reads stdin #156

@qtfkwk

Description

@qtfkwk

Describe the bug

thread '<unnamed>' (6055511) panicked at /Users/qtfkwk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/minus-5.6.1/src/core/init.rs:311:35:
Static variable RUNMODE set to uninitialized.This is most likely a bug. Please open an issue to the developers

thread 'main' (6055501) panicked at /Users/qtfkwk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/minus-5.6.1/src/core/init.rs:197:28:
called `Result::unwrap()` on an `Err` value: Any { .. }

To Reproduce

Have a CLI that optionally reads from stdin via:

let mut bytes = Vec::new();
std::io::stdin().lock().read_to_end(&mut bytes)?;

Originally had it without the .lock() but the error is the same either way. Idea was that an open stdin handle was interfering somehow with minus (?).

It manipulates the input, creates a Pager p, writes a &str to it, and then calls minus::page_all(p).

The pager works perfectly when the CLI reads from file(s) given as command line arguments and doesn't read stdin.

Expected behavior

It doesn't panic and the pager works.

Desktop:

  • OS: macOS
  • Terminal: kitty
  • Shell: zsh
  • minus Version: 5.6.1

Other details

Neither docs nor code mention any special handling with regard to stdin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions