diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-22 13:21:30 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-22 13:24:12 -0700 |
| commit | f1fb57a5cc979f5ca9c0b8ac025fb83d0aa9a7b0 (patch) | |
| tree | 8c2851b593b0de46ef5e0fa0852501d5a006206c /src/libstd/io/net/unix.rs | |
| parent | 92f6b925a9df11d3f5d0090e91ad893b1932cda9 (diff) | |
| download | rust-f1fb57a5cc979f5ca9c0b8ac025fb83d0aa9a7b0.tar.gz rust-f1fb57a5cc979f5ca9c0b8ac025fb83d0aa9a7b0.zip | |
native: Unlink unix socket paths on drop
This prevents unix sockets from remaining on the system all over the place, and more closely mirrors the behavior of libuv and windows pipes.
Diffstat (limited to 'src/libstd/io/net/unix.rs')
| -rw-r--r-- | src/libstd/io/net/unix.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index 6f48abb31c7..bf568177020 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -355,4 +355,20 @@ mod tests { rx.recv(); }) + + iotest!(fn drop_removes_listener_path() { + let path = next_test_unix(); + let l = UnixListener::bind(&path).unwrap(); + assert!(path.exists()); + drop(l); + assert!(!path.exists()); + } #[cfg(not(windows))]) + + iotest!(fn drop_removes_acceptor_path() { + let path = next_test_unix(); + let l = UnixListener::bind(&path).unwrap(); + assert!(path.exists()); + drop(l.listen().unwrap()); + assert!(!path.exists()); + } #[cfg(not(windows))]) } |
