Starting rsync via ASP.Net

M

M_at

I'm trying to automate file copying of websites between servers with a
web front end to allow our non-technical staff to make changes to sites
live in a safe and ordered manner.

I'm having difficulty using the System.Diagnostics.ProcessStartInfo
technique to start RSYNC

If I try to start RSYNC directly it doesn't terminate and does not
return control to the application.

If I try to start CMD and then pipe commands to it I do not receive
RSYNC's output.

Is there an alternative method that I may be able to try?

I'm using the following code in a C# code behind project:

System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo("d:\\cygwin\\bin\\rsync.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = @"c:\temp\";


// Start the process
System.Diagnostics.Process proc =
System.Diagnostics.Process.Start(psi);

// Attach the output for reading
System.IO.StreamReader sOut = proc.StandardOutput;

// Attach the in for writing
System.IO.StreamWriter sIn = proc.StandardInput;

// Close the process
proc.Close();

// Read the sOut to a string.
string results = sOut.ReadToEnd().Trim();

// Close the io Streams;
sIn.Close();
sOut.Close();

TextBox1.Text = results;

With this I would hope to see RSYNC's help output.
 
M

M_at

Just to follow up it appears that the ReadToEnd() (Or even replacing
this with a single ReadLine() statement) causes the hold up.

Not trying to receive any output seems to be fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top