formulahendry / formulahendry/vscode-code-runner
[Feature request]
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
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...
```js
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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.