加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Perl system()调用会死吗?

发布时间:2020-12-15 21:52:21 所属栏目:大数据 来源:网络整理
导读:可以在Perl 5中使用system()调用吗? (换句话说,为了100%防止执行system()调用的程序,是否需要将其包装到eval块中,还是完全没必要?) 我没有在 perldoc system 中找到这种可能性,但没有找到准确的“这个呼叫永远不会死”. 注意:问题是关于这里的基本CORE P
可以在Perl 5中使用system()调用吗?

(换句话说,为了100%防止执行system()调用的程序,是否需要将其包装到eval块中,还是完全没必要?)

我没有在perldoc system中找到这种可能性,但没有找到准确的“这个呼叫永远不会死”.

注意:问题是关于这里的基本CORE Perl,没有autodie或任何其他具有类似效果的自定义模块.此外,假设没有设置ALRM信号,或者任何其他自定义信号处理程序.

我假设Perl 5. *的所有版本都表现相同,但如果没有,则可以理解与5.8相关的答案.

解决方法

除非我对源代码的解释不正确,否则这似乎是一种可能性:

来源:PP(pp_system)代码块中的Perl 5.16.2(也检查5.8.8),文件:pp_sys.c,行:4224:

if (n != sizeof(int))
  DIE(aTHX_ "panic: kid popen errno read,n=%u",n);

DIE是在util.c中声明的Perl_die(pTHX_ const * pat,…)

根据文件,“恐慌:孩子popen errno读”意味着“分叉的孩子返回了一个关于其错误的难以理解的消息”.

Explanation of panic messages in Perl:

The convention is that when the interpreter dies with an internal error,the message starts “panic: “. Historically,many panic messages had been terse fixed strings,which means that the out-of-range values that triggered the panic are lost. Now we try to report these values,as such panics may not be repeatable,and the original error message may be the only diagnostic we get when we try to find the cause.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读