PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > unexpected return (LocalJumpError) when forking off a rake process
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
unexpected return (LocalJumpError) when forking off a rake process

Réponse
 
LinkBack Outils de la discussion
Vieux 04/12/2007, 18h37   #1
Hans Sjunnesson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut unexpected return (LocalJumpError) when forking off a rake process

I've written a small ruby cgi script which allows me to fork off a
rake process, which in turn forks off other processes interfacing with
subversion and ant mostly.

I have a long running rakefile and after a few minutes, it bails out
with the following error message:
../rake:28: unexpected return (LocalJumpError)
from ./rake:21:in `chdir'
from ./rake:21#!/usr/bin/ruby

Anyone got any ideas on what could cause this?


The actual cgi script follows:

require 'cgi'

cgi = CGI.new

unless cgi.has_key? 'rakefile' then
cgi.out('text/plain') {'error: rakefile parameter not set'}
return
end

BUILD_ROOT = '/opt/build/builds/' + cgi['rakefile']
target = cgi.has_key?('target') ? cgi['target'] : 'default'

unless File.exists? BUILD_ROOT then
cgi.out('text/plain') {'error: rakefile ' + cgi['rakefile'] + ' not
found'}
return
end

log = nil

Dir.chdir BUILD_ROOT do
begin
results = `rake #{target} 2>&1`
log = results
raise RuntimeError.new(log.chomp!) unless $?.success?
rescue => x
cgi.out('text/plain') {'error: ' + x + "\n" + log }
return
end
end

cgi.out('text/plain') {'done: ' + cgi['rakefile'] + "\n" + log}

--
Hans
  Réponse avec citation
Vieux 04/12/2007, 19h07   #2
Hans Sjunnesson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: unexpected return (LocalJumpError) when forking off a rakeprocess


On Dec 4, 7:37 pm, Hans Sjunnesson <hans.sjunnes...@gmail.com> wrote:
> I've written a small ruby cgi script which allows me to fork off a
> rake process, which in turn forks off other processes interfacing with
> subversion and ant mostly.
>

<snip>

As an addendum, the versions of what I'm using:
ruby 1.8.5 (2006-08-25) [x86_64-linux]
rake, version 0.7.1

--
Hans
  Réponse avec citation
Vieux 04/12/2007, 19h27   #3
Stefano Crocco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: unexpected return (LocalJumpError) when forking off a rake process

Alle marted=EC 4 dicembre 2007, Hans Sjunnesson ha scritto:
> I've written a small ruby cgi script which allows me to fork off a
> rake process, which in turn forks off other processes interfacing with
> subversion and ant mostly.
>
> I have a long running rakefile and after a few minutes, it bails out
> with the following error message:
> ./rake:28: unexpected return (LocalJumpError)
> from ./rake:21:in `chdir'
> from ./rake:21#!/usr/bin/ruby
>
> Anyone got any ideas on what could cause this?
>
>
> The actual cgi script follows:
>
> require 'cgi'
>
> cgi =3D CGI.new
>
> unless cgi.has_key? 'rakefile' then
> cgi.out('text/plain') {'error: rakefile parameter not set'}
> return
> end
>
> BUILD_ROOT =3D '/opt/build/builds/' + cgi['rakefile']
> target =3D cgi.has_key?('target') ? cgi['target'] : 'default'
>
> unless File.exists? BUILD_ROOT then
> cgi.out('text/plain') {'error: rakefile ' + cgi['rakefile'] + ' not
> found'}
> return
> end
>
> log =3D nil
>
> Dir.chdir BUILD_ROOT do
> begin
> results =3D `rake #{target} 2>&1`
> log =3D results
> raise RuntimeError.new(log.chomp!) unless $?.success?
> rescue =3D> x
> cgi.out('text/plain') {'error: ' + x + "\n" + log }
> return
> end
> end
>
> cgi.out('text/plain') {'done: ' + cgi['rakefile'] + "\n" + log}
>
> --
> Hans


I think this is not related to rake. The problem is that you are using retu=
rn=20
when you're not in a method body, which is (I think) the only place return=
=20
can be used. Looking at your code, I think you're using return to terminate=
=20
execution after displaying an error message. In this case, you should use t=
he=20
Kernel.exit method, instead.

I hope this s

Stefano

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11672 seconds with 11 queries