简体   繁体   中英

Write to standard input when svn is asking for password - c# process

I am trying to create an app that uses the Subversion command-line. I can pass through the username with the following:

process.StandardInput.WriteLine(Program.UserName);

And after that it asks for the password: Password for 'xy': . But with WriteLine it doesn't work. No characters appear:

process.StandardInput.WriteLine(Program.Password);

Program.Password contains the correct password.

Code snippet:

process.StartInfo = new ProcessStartInfo
{                    
  FileName = c.CommandName,
  Arguments = c.CommandArgs,
  UseShellExecute = false,
  RedirectStandardInput = true
};

process.Start();
process.StandardInput.WriteLine(Program.UserName);
process.StandardInput.WriteLine(Program.Password);
process.WaitForExit();

Any suggestions?

You could use a svn library, for example: http://sharpsvn.open.collab.net/

For a Walkthrough how to get started take a look at: http://sharpsvn.open.collab.net/docs/walkthrough.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM