IO redirection ᴾᴴᴾ - chung-leong/zigar GitHub Wiki

JavaScript | PHP


Hooks are install on the system functions listed below. Upon being called, a hook checks if the given file descriptor/handle points to a virtual file. If so, the call is redirected to PHP's stream wrapper sub-system. Otherwise it gets passed to the original function.

POSIX functions

Lib C functions:

MSVC-specific functions

Windows API functions

When the write target is stdout or stderr, output is redirect to the JavaScript console. You can use __zigar.redirect() to redirect it to a stream of your choice.

By default, redirection only occurs for the code within the module's binary. Calls made by shared libraries that the module links to are unaffected. You have to use zigar.io.redirect() to manually activate redirection for individual libraries. This can be done safely only when library isn't actually shared.