From: Rob H. <for...@us...> - 2002-06-19 08:04:39
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory usw-pr-cvs1:/tmp/cvs-serv12041/lib/SandWeb Modified Files: Shell.pm Log Message: finally! added decent error checking ( it has been lacking since the post-ALPHA addition of sandweb-expect and the Shell class ). I expanded on the error reporting method I used back when cvs.pm made it's own calls to the shell ... Shell returns a hash containing "output" and "error" to cvs, cvs passes it to Repository, Repository gives it to the CGI, which assigns the VCS_OUTPUT and VCS_ERROR template variables accordingly ( VCS_ERROR uses a glaring red font in the vcs_output.html template ). This along with the better debugging should give us much more info when trying to figure out why VCS actions aren't working. Index: Shell.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Shell.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -U2 -r1.15 -r1.16 --- Shell.pm 19 Jun 2002 07:19:04 -0000 1.15 +++ Shell.pm 19 Jun 2002 08:04:28 -0000 1.16 @@ -79,4 +79,8 @@ my %args = @_; + # error variable, so we have something to pass back if there are + # any problems + my $error; + # sandweb-expect is an Expect script that handles username/password # authentication for SandWeb @@ -130,8 +134,21 @@ } $output = `$command 2>&1`; + $error = $?; } $output =~ s/\r/\n/g; - return $output; + my $error_message; + if ($error) { + $error_message = "An error occurred. A call to the shell gave us this error code : $error\n"; + } else { + $error_message = ''; + } + + my %return = ( + output => "$output", + error => "$error_message", + ); + + return %return; } |