c# - Captured output is empty -
i'm trying capture output other applications. capturing output ping works well. variable output contains expected output.
var p = new process(); p.startinfo.filename = "ping"; p.startinfo.arguments = "www.google.com"; p.startinfo.useshellexecute = false; p.startinfo.redirectstandardoutput = true; p.startinfo.createnowindow = true; p.start(); var output = p.standardoutput.readtoend(); p.waitforexit();
but when use code capturing output of expdp (which oracle tool exports), variable empty. runnig same command in console return output.
p.startinfo.filename = "expdp"; p.startinfo.arguments = "help=y";
am missing ?
try checking standarderror
stream , see if there
var p = new process(); p.startinfo.filename = "expdp"; p.startinfo.arguments = "help=y"; p.startinfo.useshellexecute = false; p.startinfo.redirectstandardoutput = true; p.startinfo.redirectstandarderror = true; p.startinfo.createnowindow = true; p.start(); var error = p.standarderror.readtoend(); var output = p.standardoutput.readtoend(); p.waitforexit();
one thing note, if either output stream or error stram long, approach can cause deadlocks.
if case, you'll have read 1 of streams asynchronously.
Comments
Post a Comment