Cannot Redirect Standard Error
Posted: Mon Aug 04, 2014 9:28 pm
Please look at the following code:
It works fine, but if I set redirectStandardOutput to false, it stops working. Why do I have to redirect standard output to redirect standard error? Am I doing something wrong? Thank you. You guys are always kind and helpful. I appreciate that.
use System.Diagnostics
class Input
def main
startInfo = ProcessStartInfo()
startInfo.fileName = 'cobra'
startInfo.arguments = 'fileWithErrors'
startInfo.useShellExecute = false
startInfo.redirectStandardOutput = true
startInfo.redirectStandardError = true
process = Process()
process.startInfo = startInfo
process.start
process.waitForExit
errorOutput = process.standardError.readToEnd.splitLines
for error in errorOutput, print "Standard Error:", error
It works fine, but if I set redirectStandardOutput to false, it stops working. Why do I have to redirect standard output to redirect standard error? Am I doing something wrong? Thank you. You guys are always kind and helpful. I appreciate that.