Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send quit-package to server on stdout-error #33

Open
SvantjeJung opened this issue Sep 4, 2015 · 2 comments
Open

Send quit-package to server on stdout-error #33

SvantjeJung opened this issue Sep 4, 2015 · 2 comments

Comments

@SvantjeJung
Copy link
Contributor

Change error handling from info! to sending quit-package to server because if there is an error on stdout client will not be able to interact with server anymore. So client program must be closed.

let e = stdout().flush();
match e {
    Ok(_) => {},
    Err(_) => info!("")
}
@SvantjeJung
Copy link
Contributor Author

Found the following in this rust issue:

print!("Type something: ");
io::stdout().flush().ok().expect("Could not flush stdout");

I think that would be a nicer way to handle flush()-errors.

@LukasKalbertodt
Copy link
Member

Well... expect is just unwrap() with custom error message ;)
But sure, flush failing is too unlikely...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants