getty/login: add diagnostic logging to trace login prompt
This commit is contained in:
+18
-1
@@ -2,10 +2,17 @@
|
||||
extern crate clap;
|
||||
|
||||
use libredox::error::Result;
|
||||
use std::fs::File;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, Write};
|
||||
use std::str;
|
||||
|
||||
fn dlog(msg: &str) {
|
||||
let _ = OpenOptions::new()
|
||||
.write(true)
|
||||
.open("/scheme/debug/no-preserve")
|
||||
.and_then(|mut f| writeln!(f, "LOGIN {}", msg));
|
||||
}
|
||||
|
||||
use extra::option::OptionalExt;
|
||||
use redox_users::{All, AllUsers, Config, User};
|
||||
use termion::input::TermRead;
|
||||
@@ -118,6 +125,7 @@ fn load_config_schemes(user: &User<redox_users::auth::Full>) -> Option<Vec<Strin
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
dlog("main started");
|
||||
let mut stdout = io::stdout();
|
||||
let mut stderr = io::stderr();
|
||||
|
||||
@@ -127,12 +135,20 @@ pub fn main() {
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
dlog("before issue");
|
||||
if let Ok(mut issue) = File::open(ISSUE_FILE) {
|
||||
io::copy(&mut issue, &mut stdout).r#try(&mut stderr);
|
||||
stdout.flush().r#try(&mut stderr);
|
||||
dlog("issue printed");
|
||||
} else {
|
||||
dlog("no issue file");
|
||||
}
|
||||
|
||||
loop {
|
||||
dlog("before liner read_line");
|
||||
let _ = stdout.write_all(b"DIRECT_PROMPT_TEST");
|
||||
let _ = stdout.flush();
|
||||
dlog("direct prompt write done");
|
||||
let user = liner::Context::new()
|
||||
.read_line(
|
||||
liner::Prompt::from("\x1B[1mRed Bear login:\x1B[0m "),
|
||||
@@ -140,6 +156,7 @@ pub fn main() {
|
||||
&mut liner::BasicCompleter::new(Vec::<String>::new()),
|
||||
)
|
||||
.r#try(&mut stderr);
|
||||
dlog("after liner read_line");
|
||||
|
||||
if !user.is_empty() {
|
||||
let stdin = io::stdin();
|
||||
|
||||
Reference in New Issue
Block a user