1
0
mirror of https://github.com/irssi/irssi.git synced 2025-02-02 15:08:01 -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 $@; die $@ if $@;
eval {$package->handler;}; my $ret;
eval { $ret = $package->handler; };
die $@ if $@; die $@ if $@;
return $ret;
} }
sub eval_file { sub eval_file {

View File

@ -216,6 +216,7 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
dSP; dSP;
char *error; char *error;
int retcount; int retcount;
SV *ret;
ENTER; ENTER;
SAVETMPS; SAVETMPS;
@ -235,18 +236,18 @@ static int perl_script_eval(PERL_SCRIPT_REC *script)
error = NULL; error = NULL;
if (SvTRUE(ERRSV)) { if (SvTRUE(ERRSV)) {
error = SvPV(ERRSV, PL_na); error = SvPV(ERRSV, PL_na);
} else if (retcount > 0) {
error = POPp;
}
if (error != NULL) { if (error != NULL) {
if (*error == '\0')
error = NULL;
else {
error = g_strdup(error); error = g_strdup(error);
signal_emit("script error", 2, script, 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; PUTBACK;