Vscode-code-runner: "Live" output

Created on 30 Jan 2017  Â·  5Comments  Â·  Source: formulahendry/vscode-code-runner

I noticed this app only shows the output of code after it's 100% finished running.
When I'm running data / time intensive tasks, it's nice to have a live output as the task computes, similar to a terminal.
Is there a way to enable this currently without using the integrated terminal? If not, it would be an excellent addition.

enhancement fyi help wanted

Most helpful comment

This can be fixed for Python by adding:

 "code-runner.executorMap.python": "python -u"

to your settings.json file. Other executors might have similar settings.

By default python will buffer stdout unless it detects that it is attached to a terminal. The -u flag forces stdin, stdout and stderr to be unbuffered regardless of what it is attached to.

I think using "python -u" should probably be the default in vscode-code-runner

All 5 comments

Hi @N2ITN , are you running Python or other languages? I meet with this issue with Python, while JS and other languages is working normally with 'live' output.
As workaround, you could go to File > Preferences -> User Settings to add setting as below:

{
    "code-runner.runInTerminal": true
}

It will let you run code in built-in terminal with 'live' output.

Seems like you already try using integrated terminal. 😄 Not sure whether you are running Python or others.

Yes, you're right about me using Python. However, in some scenarios (ex:
using Keras) the output streams normal, but for others, no text is
displayed until the end (ex: calling a script to convert a folder of
files). Any thoughts on why this happens? Thanks!

On Thu, Feb 2, 2017 at 8:52 PM, Jun Han notifications@github.com wrote:

Seems like you already try using integrated terminal. 😄 Not sure whether
you are run Python or others.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/formulahendry/vscode-code-runner/issues/70#issuecomment-277164488,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALiC01ZvwaGV1iVYR4BSHHbyCSCine00ks5rYrKXgaJpZM4Lx_3M
.

This can be fixed for Python by adding:

 "code-runner.executorMap.python": "python -u"

to your settings.json file. Other executors might have similar settings.

By default python will buffer stdout unless it detects that it is attached to a terminal. The -u flag forces stdin, stdout and stderr to be unbuffered regardless of what it is attached to.

I think using "python -u" should probably be the default in vscode-code-runner

Hi all, I just publish a new release. Now, "python -u" is the default setting. Thank you all!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eegod picture eegod  Â·  5Comments

StayFoolisj picture StayFoolisj  Â·  5Comments

emadb picture emadb  Â·  5Comments

nmchgx picture nmchgx  Â·  3Comments

Yensan picture Yensan  Â·  4Comments