Skip to content

Commit 2e8e8ab

Browse files
committed
Ignore stdio mutex poison state
Nothing inside of the read/write interface itself can panic, so any poison must have been the result of user code which the lock isn't protecting.
1 parent 1ae32de commit 2e8e8ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libstd/io/stdio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Stdin {
146146
/// accessing the underlying data.
147147
#[stable(feature = "rust1", since = "1.0.0")]
148148
pub fn lock(&self) -> StdinLock {
149-
StdinLock { inner: self.inner.lock().unwrap() }
149+
StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
150150
}
151151

152152
/// Locks this handle and reads a line of input into the specified buffer.
@@ -249,7 +249,7 @@ impl Stdout {
249249
/// returned guard also implements the `Write` trait for writing data.
250250
#[stable(feature = "rust1", since = "1.0.0")]
251251
pub fn lock(&self) -> StdoutLock {
252-
StdoutLock { inner: self.inner.lock().unwrap() }
252+
StdoutLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
253253
}
254254
}
255255

@@ -319,7 +319,7 @@ impl Stderr {
319319
/// returned guard also implements the `Write` trait for writing data.
320320
#[stable(feature = "rust1", since = "1.0.0")]
321321
pub fn lock(&self) -> StderrLock {
322-
StderrLock { inner: self.inner.lock().unwrap() }
322+
StderrLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
323323
}
324324
}
325325

0 commit comments

Comments
 (0)