Hello,

  I'm trying to login to a cvs repository and upload/download files from a
php script utilizing the 'cvs' command.  I'm trying to avoid the use of
external libraries, etc...

  Is it possible to do this with popen, or more likely with proc_open? 
I'd prefer to do it with the former so as to not require PHP 4.3+, but in
my testing I've been unable to do it with either command.

  I've looked through the examples of using proc_open at php.net, but have
been unable to translate these into a script that simply logs into cvs. 
The return code from proc_close is always 1, and the best I've gotten is
an error saying "used empty password; try 'cvs login' with a real
password".

  Any pointers into how I can make this work would be greatly
appreciated!!

Here's roughly what I'm trying to do:

----------

  $dspec = array(
    0 => array("pipe", "r"), // standard in
    1 => array("pipe", "w"), // standard out
  );

  $proc = proc_open("/usr/local/bin/cvs -d pserver:@my.server:/home/cvs
login 2>&1", $dspec, $pipes);

  if(is_resource($proc)) {
    $output .= fgets($pipes[1], 1024);
    $output .= fgets($pipes[1], 14);
    fclose($pipes[1]);

    if (!fwrite($pipes[0], "cvspassword")) {
      echo "Error...";
      exit;
    } 
    fclose($pipes[0]);

    echo proc_close($proc);
    $output .= "command returned $return_value\n";
  }

----------

Thanks,
 -Jeremy

-- 
 Jeremy Andrews    <mailto:[EMAIL PROTECTED]>
 PGP Key ID: 8F8B617A  http://www.kerneltrap.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to