public RubyBufferedStream /*!*/ GetWritableStream() { var result = GetStream(); if (!_mode.CanWrite()) { throw RubyExceptions.CreateIOError("not opened for writing"); } if (!result.CanWrite) { throw RubyExceptions.CreateEBADF(); } return(result); }
public static RubyIO /*!*/ OpenPipe( RubyContext /*!*/ context, MutableString /*!*/ command, IOMode mode) { bool redirectStandardInput = mode.CanWrite(); bool redirectStandardOutput = mode.CanRead(); Process process = RubyProcess.CreateProcess(context, command, redirectStandardInput, redirectStandardOutput, false); StreamReader reader = null; StreamWriter writer = null; if (redirectStandardOutput) { reader = process.StandardOutput; } if (redirectStandardInput) { writer = process.StandardInput; } return(new RubyIO(context, reader, writer, mode)); }
private MutableString /*!*/ GetWritableContent() { if (!_mode.CanWrite()) { throw RubyExceptions.CreateIOError("not opened for writing"); } return(_content); }
private static MutableString/*!*/ CheckContent(MutableString/*!*/ content, IOMode mode) { if (content.IsFrozen && mode.CanWrite()) { throw Errno.CreateEACCES("Permission denied"); } if ((mode & IOMode.Truncate) != 0) { content.Clear(); } return content; }
private static MutableString /*!*/ CheckContent(MutableString /*!*/ content, IOMode mode) { if (content.IsFrozen && mode.CanWrite()) { throw Errno.CreateEACCES("Permission denied"); } if ((mode & IOMode.Truncate) != 0) { content.Clear(); } return(content); }
public static RubyIO/*!*/ OpenPipe( RubyContext/*!*/ context, MutableString/*!*/ command, IOMode mode) { bool redirectStandardInput = mode.CanWrite(); bool redirectStandardOutput = mode.CanRead(); Process process = RubyProcess.CreateProcess(context, command, redirectStandardInput, redirectStandardOutput, false); StreamReader reader = null; StreamWriter writer = null; if (redirectStandardOutput) { reader = process.StandardOutput; } if (redirectStandardInput) { writer = process.StandardInput; } return new RubyIO(context, reader, writer, mode); }
public static IOMode CloseRead(this IOMode mode) { return((mode & ~IOMode.ReadWriteMask) | (mode.CanWrite() ? IOMode.WriteOnly : IOMode.Closed)); }