-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: avoid stopping machine running current dir ops in isolation
get and set current dir operations used to halt the machine by throwing an exception in isolation mode. This change updates them to return a dummy NotFound error instead, and keep the machine running. I started with a custom error using `ErrorKind::Other`, but since it can't be mapped to a raw OS error, I dropped it. NotFound kind of make sense for get operations, but not much for set operations. But that's the only error supported for windows currently.
- Loading branch information
Showing
2 changed files
with
65 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use std::env; | ||
use std::io::ErrorKind; | ||
|
||
fn main() { | ||
// Test that current dir operations return the dummy error instead | ||
// of stopping the machine in isolation mode | ||
assert_eq!(env::current_dir().unwrap_err().kind(), ErrorKind::NotFound); | ||
assert_eq!(env::set_current_dir("..").unwrap_err().kind(), ErrorKind::NotFound); | ||
} |