cling
cling copied to clipboard
Shell command
As you know, I work with @SylvainCorlay and @JohanMabille on https://github.com/QuantStack/xeus-cling to have a fully kernel C++ based on xeus and cling.
We have a first version which works in Jupyter. To have the cout and cerr of cling, we use a redirection of the Interpreter output.
Unfortunately, the shell command (.!
) used in cling calls the std::system
function. So it is not possible for us to keep the output of the shell command.
A hack could be to save the result in a file with the redirection > tmp_file
and then print the output in cling::outs()
.
@vgvassilev, do you have any idea of how to do that ? I have tried with the construction of temporary files but it is too complicated with C++. The only solution that I found is to mix with C programming using popen ...
I am not aware of any other way to do it. I think redirecting to cling::outs()
and cling::errs()
makes sense. Could you submit a PR once you have it?
Ok. I will try to write something that works with popen.