Refactoring std os setenv#14736
Refactoring std os setenv#14736darnuria wants to merge 4 commits intorust-lang:masterfrom darnuria:refactoring_std_os_setenv
Conversation
src/compiletest/compiletest.rs
Outdated
There was a problem hiding this comment.
I think this would be better as fail!("setenv failed: {}", e).
Error handling through std::io::IoResult.
|
The only documented error case on unix for Are there error cases for windows that we're worried about not catching? If it's just OOM then I'd tend to think that these functions should continue to return |
|
@alexcrichton: Funny on my Linux I have two errors documented. man setenv on Ubuntu 14.04: And rustc is compiled with: |
|
Ah yes, I also had |
|
So the best solution is to:
If somebody wants to write something like a shell in Rust it would be nice to have the possibility to check errors like theses instead of having a internal error. |
|
I would have to look at other functions as well, but failing on NUL is pretty common throughout the codebase, and it may be intentional rather than accidental. For now though, I'm going to close this pending further investigation. |
|
@alexcrichton https://gist.github.com/darnuria/9312f285ee8b265abf92 |
|
That is an interesting case! |
Simplifies the implementation a bit, also makes the message an error annotation changelog: none
Hello!
After talking with @huonw on Irc and trying different thing, I purpose to add a error handling over this wrapper of libc::setenv for catching errors.
I will need some help on the two commit marked as
fixup!. I am still a newbie to rust. :)