开发者

Redefine stdout in FastCGI and Octave

开发者 https://www.devze.com 2023-01-26 14:46 出处:网络
I\'m working on implementing an Octave interpreter inside of an FastCGI session using C/C++ in Ubuntu Linux. 开发者_C百科The problem I\'m running into is that FCGI redirects stdout to FCGI_stdout, but

I'm working on implementing an Octave interpreter inside of an FastCGI session using C/C++ in Ubuntu Linux. 开发者_C百科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.

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.

Thanks


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:

http://octave.1599824.n4.nabble.com/dup2-on-stdout-or-using-disp-on-another-file-stream-td1611884.html

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消