在FastCGI和Octave中重新定义标准输出 [英] Redefine stdout in FastCGI and Octave

查看:60
本文介绍了在FastCGI和Octave中重新定义标准输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在在Ubuntu Linux中使用C/C ++在FastCGI会话中实现Octave解释器.我遇到的问题是FCGI将 stdout 重定向到 FCGI_stdout ,但是预编译的Octave标头设法仍然使用正常的 stdout 在Apache的error.log中,而不是打印到浏览器中.

I'm working on implementing an Octave interpreter inside of an FastCGI session using C/C++ in Ubuntu Linux. The problem I'm running into is that FCGI redirects stdout to FCGI_stdout, but the precompiled Octave headers manage to still use the normal stdout which ends up in Apache's error.log instead of printed to the browser.

您是否知道一种将Octave从使用系统的 stdout 重定向到使用FCGI的 stdout 的方法?甚至只是让它将 stdout 重定向到文件,而无需修改Octave的代码并重新编译.

Do any of you know a way to redirect Octave from using the system's stdout to use FCGI's stdout? Or even just to have it redirect stdout to a file without having to modify Octave's code and recompile.

谢谢

推荐答案

如果有人这样来回答我自己的问题:在八度中专门设置stdout似乎无效,也没有尝试临时重定向stdout的尝试.在系统级别.但是,八度具有命令dup2,其用法如下:

To answer my own question if anybody else comes this way: Specifically setting stdout in octave doesn't seem to work, and neither do any attempts to temporarily redirect stdout at the system level. However, octave has the command dup2, used as described here:

这可用于将八度的stdout重定向到一个文件,以供另一个程序读取(或者一旦获得PID,则可能会快速cgi自己的stdout流)

This can be used to redirect octave's stdout to a file to be read by another program (or likely to fast-cgi's own stdout stream once you have the PID)

这篇关于在FastCGI和Octave中重新定义标准输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆