c# - Why does RedirectStandardInput has no effect when ProcessStartInfo.CreateNoWindow is set to true? -


i use system.diagnostics.process interact third party console application of stdin/out/err have been redirected (the external program written in c++ , not have no control on it).

processstartinfo info = new processstartinfo(filename, arg);  info.createnowindow = false; // <- if true, stdin writes don't make through info.useshellexecute = false; info.redirectstandardinput  = true; info.redirectstandardoutput = true; info.redirectstandarderror  = true;  var proc = new process() { startinfo = info }; proc.outputdatareceived += new datareceivedeventhandler(myoutputhandler); proc.errordatareceived  += new datareceivedeventhandler(myerrorhandler); proc.start(); proc.beginoutputreadline(); proc.beginerrorreadline(); 

later...

proc.standardinput.writeline("some-short-command"); 

works ok in test console app when info.createnowindow = false; has no effect when info.createnowindow = true;

the output , error redirection work fine in both cases.

the above code part of class library defining custom actions finalbuilder. described behavior can observed test console application or running within finalbuilder desktop application.

interestingly when run third context - finalbuilder server - same user , environment, standardinput.writeline has no effect, whether info.createnowindow true or false.

what going on?

can make stdin redirection work regardless of execution context?

not sure why explicitly specifying user here solves problem:

proc.username = user; proc.domain= domain; proc.password= password; 

not elegant works me , may someone.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -