--- trunk/lib/Frey/Server.pm 2008/11/26 07:58:05 533 +++ trunk/lib/Frey/Server.pm 2008/11/26 19:13:53 542 @@ -85,11 +85,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 @@ -158,7 +168,10 @@ my $html = $f->html; die "no html output" unless $html; warn "## html ",length($html)," bytes"; - $req->print( "$html\n" ); + eval { + $req->print( $html ); + }; + die "can't send to wire: $@" if $@; } else { warn "# can't call request on nothing!"; } @@ -182,7 +195,7 @@ send_message($req); } - if ($req->conn ) { + if ( $req->conn ) { $req->conn->close; warn "## close connection: $@"; }