weihanglo / sfz

A simple static file serving command-line tool written in Rust.
https://crates.io/crates/sfz
Apache License 2.0
400 stars 30 forks source link

fix: do not use stdin which will stop when running in background #66

Closed weihanglo closed 3 years ago

weihanglo commented 3 years ago

Fixes #65.

This bug was introduced by #63, which is too rush to handle STDIN inproperly. Although we can try to handle STGTTIN in Unix system but I cannot find an easy way to deal other platform like Windows. We'll revert the Ctrl-D key binding feature and back to the good old Ctrl-C.

When a process in a background job tries to read from its controlling terminal, the process group is usually sent a SIGTTIN signal. This normally causes all of the processes in that group to stop (unless they handle the signal and don’t stop themselves).

Ref: https://www.gnu.org/software/libc/manual/html_node/Access-to-the-Terminal.html

weihanglo commented 3 years ago

It would be great if someone can provide a viable cross-platform solution.