1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

If script returns 0 while it's being loaded, it's terminated without any

error message.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2885 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-08-25 16:04:11 +00:00 committed by cras
parent c7cfe9f3cb
commit 4bb26bb951
2 changed files with 14 additions and 11 deletions

View File

@ -30,8 +30,10 @@ sub eval_data {
}
die $@ if $@;
eval {$package->handler;};
my $ret;
eval { $ret = $package->handler; };
die $@ if $@;
return $ret;
}
sub eval_file {

View File

@ -216,6 +216,7 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
dSP;
char *error;
int retcount;
SV *ret;
ENTER;
SAVETMPS;
@ -234,19 +235,19 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
error = NULL;
if (SvTRUE(ERRSV)) {
error = SvPV(ERRSV, PL_na);
} else if (retcount > 0) {
error = POPp;
}
error = SvPV(ERRSV, PL_na);
if (error != NULL) {
if (*error == '\0')
error = NULL;
else {
error = g_strdup(error);
if (error != NULL) {
error = g_strdup(error);
signal_emit("script error", 2, script, error);
g_free(error);
g_free(error);
}
} else if (retcount > 0) {
/* if script returns 0, it means the script wanted to die
immediately without any error message */
ret = POPs;
if (ret != &PL_sv_undef && SvIOK(ret) && SvIV(ret) == 0)
error = "";
}
PUTBACK;