[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does "cvs update" return anything?

From: Daniel Beckham
Subject: Re: Does "cvs update" return anything?
Date: Thu, 28 Jun 2001 09:32:10 -0500

Actually.. you should be using the system() call to get the error code
returned.  See the perlfunc manpage for details. 'perldoc -f system'.


if (system('/usr/local/bin/cvs', 'update') == 0) {
    print "it worked!\n";

----- Original Message -----
From: "Matthew Riechers" <address@hidden>
To: <address@hidden>
Sent: Thursday, June 28, 2001 7:33 AM
Subject: Re: Does "cvs update" return anything?

> Dorthe Luebbert wrote:
> >
> > Hi,
> >
> > I wrote a script in Perl to update a directory tree with several
> > installations of the same cvs module.
> > The script traverses the directory tree, whenever it reaches the
> > searched directory it updates with "cvs update". The problem is that the
> > script works fast and the cvs server cannot stand the amount of requests
> > (hypothesis). I wonder if
> > a) "cvs update" returns anything (like "connection was not successfull")
> CVS does return an error code. For a quick example, (in sh) do 'cvs
> update' and then 'echo $?' ($? is the error code from the last process),
> first in a checked-out directory, then in one w/o any working dirs. The
> first echo should give you '0', the second should be '1'. You can use
> this as the return value, 0 being no errors.
> > b) I can pipe the cvs update result anywhere (cvs update | grep
> > "connection refused" --> does one not work...) :-(
> You are only grepping stdout by default. Errors conventionally show up
> on stderr, not stdout. You need to redirect stderr into stdout, or log
> each seperately. I can't recall how to do that in perl, but in sh you
> can have a log for each file descriptor: 'cvs update > /normal_msgs.log
> 2> /error_msgs.log' (2 being stderr), or you can reassign one into the
> other: 'cvs update > /big.log 2>&1' (stderr is reassigned to stdout).
> For pipes, you have to redirect before the pipe: 'cvs update 2>&1 |grep
> "error"'.
> >
> > I just want to find out wether the cvs update was successful or not and
> > stop the script in case it was not.
> >
> It may be easier to just log/grep all errors and let the script finish,
> and then dump the error log to the screen to show what failed. You can
> also try sleep() or equivalent between updates to ease the load on the
> server.
> > Thanx for your help
> >
> >  Dorthe
> -Matt
> _______________________________________________
> Info-cvs mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]