ommp.git

ommp

~ Oh My Music Player — a standalone terminal music player built with Rust and ratatui
git clone https://github.com/debuman/ommp.git
commit fe95286fa8a69df1316763866a60dbb0762b00f4
parent 87ad44bba361533c12ca96c32c1dab87c81d115a
Author: sqzer-x <110329244+sqzer-x@users.noreply.github.com>
Date: Sat, 1 Aug 2026 17:55:09 +0900

Say what to do when stdin or stdout is not a terminal

Raw mode failed with a bare "No such device or address", which says
nothing about the cause. Check both streams up front and explain that ommp
needs an interactive terminal and cannot run through a pipe or a redirect.

Version bumped to 0.1.1: crates.io versions are immutable, so 0.1.0 cannot
carry this.

Diffstat:
MCargo.lock | 2+-
MCargo.toml | 4++--
Msrc/main.rs | 14++++++++++++++
3 files changed, 17 insertion(+), 3 deletion(-)

diff --git a/Cargo.lock b/Cargo.lock
@@ -932,7 +932,7 @@ dependencies = [
 
 [[package]]
 name = "ommp"
-version = "0.1.0"
+version = "0.1.1"
 dependencies = [
  "anyhow",
  "crossbeam-channel",
diff --git a/Cargo.toml b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "ommp"
-version = "0.1.0"
+version = "0.1.1"
 edition = "2021"
 authors = ["sqzer-x"]
 description = "Oh My Music Player — a terminal music player built with ratatui"
@@ -10,7 +10,7 @@ keywords = ["music", "player", "tui", "terminal", "ratatui"]
 categories = ["command-line-utilities", "multimedia::audio"]
 # 1.2 MB that everyone installing the crate would download, for an image
 # crates.io cannot resolve from a relative README path anyway.
-exclude = ["assets/screenshot.png"]
+exclude = ["assets/screenshot.png", "packaging"]
 
 [dependencies]
 ratatui = "0.29"
diff --git a/src/main.rs b/src/main.rs
@@ -14,6 +14,7 @@ use crossterm::{
     execute,
     terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
 };
+use crossterm::tty::IsTty;
 use ratatui::backend::CrosstermBackend;
 use ratatui::Terminal;
 
@@ -51,6 +52,19 @@ fn restore_terminal() {
 }
 
 fn main() -> Result<()> {
+    // Raw mode fails with a bare "No such device or address" when stdin or
+    // stdout is not a terminal, which says nothing about what to do.
+    if !io::stdin().is_tty() || !io::stdout().is_tty() {
+        eprintln!("ommp is a full-screen terminal application and needs an interactive terminal.");
+        eprintln!();
+        eprintln!("Run it directly in your terminal:");
+        eprintln!();
+        eprintln!("    ommp");
+        eprintln!();
+        eprintln!("It cannot run through a pipe, a redirect, or a non-interactive shell.");
+        std::process::exit(1);
+    }
+
     setup_terminal()?;
 
     // Restore before the default hook prints: a panic message written while the