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

perl:IPC :: Open3无法使用FCGI打开STDERR

发布时间:2020-12-16 06:13:26 所属栏目:大数据 来源:网络整理
导读:我用我的fcgi脚本测试了 Git :: Repository.我既不能创建一个git对象,也不能使用该模块运行任何git命令. IPC :: Open3 :: open3失败并出现错误: Not a GLOB reference at /usr/local/lib/perl/5.10.1/FCGI.pm line 125 我在FCGI :: OPEN()中添加了一个cluck
我用我的fcgi脚本测试了 Git :: Repository.我既不能创建一个git对象,也不能使用该模块运行任何git命令. IPC :: Open3 :: open3失败并出现错误:

Not a GLOB reference at /usr/local/lib/perl/5.10.1/FCGI.pm line 125

我在FCGI :: OPEN()中添加了一个cluck,并在IPC :: Open3 :: xopen()中添加了警告,这是我得到的:

mod_fcgid: stderr: IPC::Open3::xopen() called with args: GLOB(0xe92360) <&=5 
mod_fcgid: stderr: IPC::Open3::xopen() called with args: GLOB(0xe92438) >&=9 
mod_fcgid: stderr: IPC::Open3::xopen() called with args: GLOB(0xe92498) >&=12 
mod_fcgid: stderr: FCGI::OPEN() called with args: FCGI::Stream=SCALAR(0x14e43f0) >&=12 
mod_fcgid: stderr:  at /usr/local/lib/perl/5.10.1/FCGI.pm line 125 
mod_fcgid: stderr: tFCGI::Stream::OPEN('FCGI::Stream=SCALAR(0x14e43f0)','>&=12') called at /usr/share/perl/5.10/IPC/Open3.pm line 67 
mod_fcgid: stderr: tIPC::Open3::xopen('GLOB(0xe92498)','>&=12') called at /usr/share/perl/5.10/IPC/Open3.pm line 162 
mod_fcgid: stderr: 
mod_fcgid: stderr: tIPC::Open3::_open3('open3','MyModule','GLOB(0x1a56078)','GLOB(0x1906738)','GLOB(0x12f5430)','/usr/bin/git','--version') called at /usr/share/perl/5.10/IPC/Open3.pm line 233 
mod_fcgid: stderr: tIPC::Open3::open3('GLOB(0x1a56078)','--version') called at /usr/local/lib/site_perl/MyModule.pm line 113

仅在打开STDERR时才调用FCGI :: OPEN(). STDIN和STDOUT未达到FCGI :: OPEN().我看了看IPC :: Open3,这就是失败的地方:

if ($dad_rdr ne $dad_err) {
    if ($dup_err) {
        # I have to use a fileno here because in this one case
        # I'm doing a dup but the filehandle might be a reference
        # (from the special case above).
        xopen *STDERR,">&" . xfileno($dad_err)
            if fileno(STDERR) != xfileno($dad_err);
    } else {
        xclose $dad_err;
        xopen *STDERR,">&=" . fileno $kid_err;  # this is failing
    }
} else {
    xopen *STDERR,">&STDOUT" if fileno(STDERR) != fileno(STDOUT);
}

我可以用IPC :: Run :: start替换open3,一切正常.但我真的很想知道STDERR出了什么问题.它是FCGI.pm或Open3.pm的错误还是我做错了什么?

我运行apache 2.2.16与libapache2-mod-fcgid 1:2.3.6,libfcgi-perl 0.71-1和libcgi-fast-perl 5.10.1关于debian squeeze. Perl版本是5.10.1.

如何重现:

use CGI::Fast;
use Symbol ();
use IPC::Open3 qw(open3);

while (my $cgi = new CGI::Fast) {
    my $pid;
    my $in  = Symbol::gensym;
    my $out = Symbol::gensym;
    my $err = Symbol::gensym;    

    $pid = open3( $in,$out,$err,'--version');

}

解决方法

这应该在System-Command的最新版本(1.102)中修复:
https://metacpan.org/release/BOOK/System-Command-1.102

补丁是
https://github.com/book/System-Command/commit/d5009728cc66e5f9bb2057df4be70648571a29cd

(编辑:李大同)

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

    推荐文章
      热点阅读