[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Redirecting stdin/stdout
- From: Dibyendu Majumdar <mobile@...>
- Date: Fri, 25 Mar 2016 11:26:54 +0000
Hi
I am working on implementing a debug adapter for Lua/Ravi for VSCode.
The way VSCode interacts with the adapter is via stdin/stdout. So I
have two options for interacting with the Lua VM:
a) VSCode launches the Debug Adapter (as a process) which then
launches Lua as another separate process and communicates with Lua
over TCP/IP (similar to MobDebug).
b) VSCode launches the Debug Adapter (as a process) which then runs
Lua in-process.
I prefer b) for now, eventually I may also look at a). But in order to
implement b) I need to get Lua to avoid reading/writing from
stdin/stdout directly. So I am thinking of adding fields in lua_State
that will hold stdin/stdout file descriptors that Lua should use - so
that I can set these to alternative file descriptors. I would like to
redirect Lua's stdout to a file, while the real stdout is taken over
by the debug adapter. Similarly Lua's stdin will read from a file,
while the real stdin is read by the debug adapter.
Has anyone done a similar redirection exercise before?
Regards
Dibyendu