Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] #1187

Open
MaxZhirniy opened this issue Oct 25, 2024 · 0 comments
Open

[Feature request] #1187

MaxZhirniy opened this issue Oct 25, 2024 · 0 comments

Comments

@MaxZhirniy
Copy link

MaxZhirniy commented Oct 25, 2024

Add support for user input with running code in output-tab. Im try write it, but get a problem: probably, node.js cant understand that the child_process.spawn() is waiting for input...

this._process = spawn(command, [], { cwd: this._cwd, shell: true, stdio: ['pipe', 'pipe', 'pipe'] });
            this._inputTimeStart, this._inputTimeEnd = 0, 0;
            this._process.stdin.setEncoding = 'utf-8';
            this._process.stdin.on("data", () => {
                this._inputTimeStart = new Date();
                vscode.window.showInputBox({placeHolder: "enter data", prompt: "For code need input."}).then( (input) => {
                    if (input !== undefined){
                        this._process.stdin.write(toString(input));
                        this._outputChannel.append(iconv.decode(input, "utf-8"));
                    }
                    this._process.stdin.end();
                });
                this._inputTimeEnd = new Date();
            });

at this block i try to implement the ability to input via inputBox, but failed, the inuktbox just doesn't appear. Dont care about inputTimeStart and inputTimeEnd, they need for ignore the time it takes to receive input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant