public override void close(CodeContext /*!*/ context) { if (_closed) { return; } flush(context); _closed = true; _readStream.Close(); _readStream.Dispose(); if (!object.ReferenceEquals(_readStream, _writeStream)) { _writeStream.Close(); _writeStream.Dispose(); } PythonFileManager myManager = _context.RawFileManager; if (myManager != null) { myManager.Remove(this); } }
public override void close(CodeContext /*!*/ context) { if (_closed) { return; } try { flush(context); } catch (IOException) { // flushing can fail, esp. if the other half of a pipe is closed // ignore it because we're closing anyway } _closed = true; if (_closefd) { if (_readStream != null) { _readStream.Close(); _readStream.Dispose(); } if (_writeStream != null && !ReferenceEquals(_readStream, _writeStream)) { _writeStream.Close(); _writeStream.Dispose(); } PythonFileManager myManager = _context.RawFileManager; myManager?.Remove(this); } }