Skip to content

使用ruby的popen模块封装后遇到输出堆积的问题 #1

@wangzf0225

Description

@wangzf0225

我使用ruby对phptrace进行了封装,封装后执行phptrace -p all命令,每访问8次php文件,才会出现一次输出,每次输出会将8次执行的结果一起输出。请问是什么原因,应该如何解决?
`
require 'open3'

cmd = 'sh'

Open3.popen2e(cmd) do |stdin, stdout_stderr, wait_thread|
Thread.new do
stdout_stderr.each {|l| puts l }
end

stdin.puts 'phptrace -p all'
stdin.close

wait_thread.value
end
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions