Starting rsync via ASP.Net

Discussion in 'ASP .Net' started by M_at, Mar 27, 2006.

  1. M_at

    M_at Guest

    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_at, Mar 27, 2006
    #1
    1. Advertising

  2. M_at

    M_at Guest

    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.
     
    M_at, Mar 28, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joshua Jung
    Replies:
    2
    Views:
    5,035
    Joshua Jung
    Jun 30, 2006
  2. Rasmusson, Lars
    Replies:
    1
    Views:
    760
    popov
    Apr 30, 2004
  3. David Bear

    rsync protocol in python

    David Bear, Jun 27, 2005, in forum: Python
    Replies:
    1
    Views:
    6,012
    Robert Kern
    Jun 27, 2005
  4. William Dode

    subprocess freeze with rsync on windows

    William Dode, Apr 7, 2006, in forum: Python
    Replies:
    0
    Views:
    372
    William Dode
    Apr 7, 2006
  5. timw.google
    Replies:
    8
    Views:
    682
    timw.google
    Oct 9, 2007
Loading...

Share This Page