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

Fix str::from_utf8(...).unwrap() #300

Closed
stanislav-tkach opened this issue Mar 22, 2022 · 3 comments
Closed

Fix str::from_utf8(...).unwrap() #300

stanislav-tkach opened this issue Mar 22, 2022 · 3 comments

Comments

@stanislav-tkach
Copy link
Owner

See #295 for details.

@martintc
Copy link
Contributor

martintc commented Mar 22, 2022

Oh okay, was under the assumption that if an error occured, it would hit _ =>. So, since from_utf8 returns a result, can we cast aside the unwrap() and instead do something like:

 match str::from_utf8(&os.stdout) {
        Ok("FreeBSD\n") => { // some code},
        Err(_) => Type::FreeBSD
}

@martintc
Copy link
Contributor

martintc commented Apr 11, 2022

Ill get the implemented in code. I also noticed I can probably call trim() and remove the new line escape characters in the string literals, making the code look a little cleaner.

@martintc martintc mentioned this issue Apr 11, 2022
@stanislav-tkach
Copy link
Owner Author

Closed with #303.

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

No branches or pull requests

2 participants