c# - Unable to read the full output redirected from Console application - SVN Update automation -


i trying automate update procedure svn update using console application. use following code below.

processstartinfo svnupdate = new processstartinfo(); svnupdate.arguments =  string.format("update \"{0}\" -r {1}", destination,  revisionno); svnupdate.filename = "svn.exe"; svnupdate.createnowindow = true; svnupdate.useshellexecute = false; svnupdate.windowstyle = processwindowstyle.hidden; svnupdate.redirectstandardoutput = true; svnupdate.redirectstandarderror = true;  process p = new process(); p.startinfo = svnupdate; p.enableraisingevents = true; p.start(); svnoutput = p.standardoutput.readtoend(); p.waitforexit();  if (p.hasexited) { console.writeline("received output test : " + svnoutput); } p.close(); p.dispose(); 

the above code works fine if there no errors returned update command. if there errors able first line of outpput returned when set code below console gives me full error text.

svnupdate.redirectstandardoutput = false; svnupdate.redirectstandarderror = false; 

sample outpput when have redirection false.

updating 'c:\testsvnrepo': svn: e175002: unable connect repository @ url 'http://svnrepositoryadd/svn/testsvnrepo' svn: e175002: unexpected http status 500 'internal server error' on '/svn/testsvnrepo'  svn: e720003: additional errors: svn: e720003: not open requested svn filesystem 

sample output received in string when have redirection true.

updating: 'c:\testsvnrepo': 

i believe output you're missing sent through stderr, not stdout. in code, you're looking @ stdout (svnoutput = p.standardoutput.readtoend();)

you need read stderr - p.standarderror.readtoend();

as aside, recommend rather automating svn.exe , adding both application , environment dependency (iow, app requires svn.exe present on system and in either %path% or known absolute path specify), use sharpsvn provides .net implementation of svn api itself.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -