node-progress icon indicating copy to clipboard operation
node-progress copied to clipboard

Does not generate output in VS Code

Open relief-melone opened this issue 7 years ago • 4 comments

Hey,

I'm using the progress bar in a project of mine. Strangely it shows up in GitBash in cmd and in the powershell but it doesn't show in the vs code debugger. Do you have any explanations? So far I've not been able to get it to work.

relief-melone avatar Aug 23 '18 08:08 relief-melone

im having the opposite issue - it shows in vscode (which is set to use gitbash), but doesnt show in the standalone git bash

This seems to be related to #133

Another observation - for me, the progress bar doesnt appear when I use Program Files\Git\git-bash.exe, however if i use Program Files\Git\bin\bash.exe it DOES appear. The second exe (bash.exe) is what my VSCode is set up to use, perhaps this is why some people are seeing it and others not

edit: It seems the difference is that git-bash.exe has process.stderr.isTTY as undefined, but bash.exe has it as true

Something about the way stderr/stdout behaves when it is in TTY mode is what is causing this issue i think

edit 2: I think its because git-bash actually calls bash.exe and pipes between it, so calls to stderr get sent to the wrong place and dont display? but im not sure, i dont know heaps about bash/piping

edit 3: I just noticed that in the render function there is this

 if (!this.stream.isTTY) return;

that would explain why nothing is happening. if its impossible to get the correct behaviour if the stream is not TTY, can we at least have some kind of graceful degradation?

Ok it turns out this issue is resolved by #168

In the meantime i fixed it by just doing this:

if(!process.stderr.isTTY){
	const tty = require('tty').WriteStream.prototype;
	for(var key in tty){
		process.stderr[key] = tty[key]
	}
	process.stderr.columns = 80
}

Adding the follow option to launch.json works:

"console": "integratedTerminal"

jrrcdev avatar Aug 07 '22 00:08 jrrcdev