--- trunk/lib/Frey/Server.pm 2008/11/26 16:33:58 536 +++ trunk/lib/Frey/Server.pm 2008/11/27 22:29:01 571 @@ -62,6 +62,8 @@ sub main { my ($req) = @_; +# $req->send_headers("X-Frey-VERSION: $Frey::VERSION"); + my $path = $req->request->url->path; eval { @@ -85,11 +87,21 @@ } if ( $path =~ m{/reload(.*)} ) { - Frey::Server->new->load_config; - Module::Reload->check; - warn "# reload done"; - $req->print( refresh( $1, 1 ) ); - return; + + $ENV{FREY_NO_LOG} = 1; + my $cmd = "perl -c $0"; + warn "# check config with $cmd"; + if ( system($cmd) == 0 ) { + Frey::Server->new->load_config; + Module::Reload->check; + $req->print( refresh( $1, 1 ) ); + warn "# reload done"; + return; + } else { + warn "ERROR: $?"; + } + $ENV{FREY_NO_LOG} = 0; + } elsif ( $path =~ m{/exit(.*)} ) { # FIXME do we need some kind of check here for production? :-) # ./bin/dev.sh will restart us during development @@ -140,6 +152,7 @@ warn "# run $path -> $class $2"; $run->{format} = $3 if $3; $params{request_url} = $req->request->url; + $req->print( "\r\n\r\n" ); # send something to browser so we don't time-out $f = Frey::Run->new( class => $class, params => \%params, run => $2, %$run ); } elsif ( $path =~ m{/([^/]+)/?$}