Taritsyn / JavaScriptEngineSwitcher

JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines. This library allows you to quickly and easily switch to using of another JavaScript engine.
Apache License 2.0
439 stars 49 forks source link

[Q&A] How to pass stdio to nodejs #110

Closed soroshsabz closed 1 year ago

soroshsabz commented 1 year ago

ITNOA

I want to link my stdio from C# Console Application to NodeJs, to better describe my question, I create a sample like below

I have some code like below

            IJsEngine engine = new NodeJsEngine(new NodeSettings { UseBuiltinLibrary = true});
            engine.ExecuteFile("SpawnServer.js");

and my SpawnServer.js is like below

const { spawn } = require("child_process");

console.log('Hi');
process.stdout.write("Hi");
spawn("npx", ["ansible-language-server"].concat(" --stdio"), { stdio: 'inherit' });

I like to see Hi in my C# Console Application, But I do not know, How to do it?

Note: All code is in https://github.com/soroshsabz/visualstudio-ansible/tree/features/4-support-ansible-language-server

thanks

soroshsabz commented 1 year ago

I add this question in SO

Taritsyn commented 1 year ago

Hello!

I think this question should be asked to @JeremyTCD.

soroshsabz commented 1 year ago

@Taritsyn thanks for reply, you correct, but I ask this question in this Repo, because I want to know, Did you have implement any interface for passing stdio from C# to NodeJs or not?

thanks

Taritsyn commented 1 year ago

… Did you have implement any interface for passing stdio from C# to NodeJs or not?

Currently, there are no interop features in the JavaScriptEngineSwitcher.Node module, because there are no corresponding features in current stable version of the Jering.Javascript.NodeJS library.

soroshsabz commented 1 year ago

Thanks for response, So I close this issue, if backend library, support this, feature, I ask you to reopen this issue

thanks again