[p4ruby] p4ruby sync problem

Tony Smith tony at smee.org
Thu Mar 31 05:57:53 PST 2005


On Thursday 31 March 2005 11:15, Joerg Krautwurst-Schmid wrote:
> Well I think I got the problem,
>
> <snip>
>
> begin
>     p4.connect()
>     a=p4.run_sync
> rescue P4Exception => msg
>    puts( msg )
>     p4.warnings.each { |w| puts( w ) }
>     p4.errors.each { |e| puts( e ) }
>     p4.output.each { |o| puts( o ) }
> end
>
> </snip>
>
> I took this snippet from the example.rb. My problem was that the
> "file(s) up-to-date" message from perforce is a warning (well it's like
> it is).
> Now I can check this.

Yes, that's it. You could also set the exception_level to P4::RAISE_ERRORS (or 
1) which will suppress the raising of exceptions for warnings. For example:

 p4 = P4.new
 p4.parse_forms
 p4.exception_level = P4::RAISE_ERRORS
 p4.connect
 begin
  p4.run_sync
 rescue P4Exception
  p4.errors.each { |e| $stderr.puts( e ) }
 end

Tony      



More information about the p4ruby mailing list