Pregunta

I am using the following code to execute the ClearCase statement "Accept" from a perl script.

$acceptA = `accept $Component`;

After execution, inside my perl script, the value of $acceptA is blank.

The text displayed on the screen during execution of this line is : "ERROR You do not have permissions to ACCEPT this work."

How do I read this line? I thought it would return into the variable $acceptA as it does with the "cleartool checkin" command?

¿Fue útil?

Solución

As i do not know ClearCase and how that accept works, i can only guess. Seeing how it is an error message, it might be written to STDERR instead of STDOUT and backticks only capture STDOUT of the command executed. In that case, redirecting the commands STDERR to STDOUT would work. Try

$acceptA = `accept $Component 2>&1`

and see if that works in capturing the output in case of error as well.

Otros consejos

I eventually redirected SYSERR to an output file which I could read/write.

open STDERR, ">/ellipse/el6.3.3_ry_sup/src/0/$logfile"

All the error messages that was displayed on the screen as part of the system command, went into $logfile.

I was also able to add to SYSERR with the following: print STDERR "\nAccepting $Component";

Thanks for all the help.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top