Repository: ilai-deutel/kibi (language: rust)

Issue:
Kibi on Termux fails to start
**Describe the bug**
When I start kibi on termux, i returns a "Permission Denied" error (as you can see in the sreenshot )
Note: I have all permissions required to edit the file.

**To Reproduce**
Use `pkg install kibi` and try to open a file. Note: same error is given if kibi is installed with `cargo install kibi`

**Expected behavior**
Open editor and start editing the file

**Screenshots**


**System information**:
 -  OS: Termux (nonroot)
 - Rust version: 1.49
- Kibi version : V0.2.1

Thanks for this really good work, Woomy



Discussion / hints:
Seems i can't upload screenshot.

Here is the console output:

```
Error: IO(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })
```
Thank you for reporting this, I can reproduce the issue. I think that either the main config file or one of the syntax highlighting files are not readable, which causes the issue.

I'll look into it shortly.

Fix patch:
diff --git a/src/unix.rs b/src/unix.rs
index 1e8de6cd..18712df1 100644
--- a/src/unix.rs
+++ b/src/unix.rs
@@ -8,7 +8,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
 // On UNIX systems, termios represents the terminal mode.
 pub use libc::termios as TermMode;
 use libc::{c_int, c_void, sigaction, sighandler_t, siginfo_t, winsize};
-use libc::{SA_SIGINFO, STDIN_FILENO, STDOUT_FILENO, TCSAFLUSH, TIOCGWINSZ, VMIN, VTIME};
+use libc::{SA_SIGINFO, STDIN_FILENO, STDOUT_FILENO, TCSADRAIN, TIOCGWINSZ, VMIN, VTIME};
 
 use crate::Error;
 
@@ -91,7 +91,7 @@ pub fn has_window_size_changed() -> bool { WIN_CHANGED.swap(false, Ordering::Rel
 
 /// Set the terminal mode.
 pub fn set_term_mode(term: &TermMode) -> Result<(), Error> {
-    cerr(unsafe { libc::tcsetattr(STDIN_FILENO, TCSAFLUSH, term) })
+    cerr(unsafe { libc::tcsetattr(STDIN_FILENO, TCSADRAIN, term) })
 }
 
 /// Setup the termios to enable raw mode, and return the original termios.


Test patch: