diff options
author | Timo Sirainen <cras@irssi.org> | 2002-08-25 16:04:11 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-08-25 16:04:11 +0000 |
commit | 4bb26bb9518a0166e2102eef139b518fae8d20b6 (patch) | |
tree | c26de519d3f44117277b9d00bf20aba0ea2cb5cd /src/perl/perl-core.c | |
parent | c7cfe9f3cb21e1dd19f6cbbf3230eab6090d496b (diff) | |
download | irssi-4bb26bb9518a0166e2102eef139b518fae8d20b6.zip |
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
Diffstat (limited to 'src/perl/perl-core.c')
-rw-r--r-- | src/perl/perl-core.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index accd5ef4..0c1e506b 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -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; |