-
Notifications
You must be signed in to change notification settings - Fork 299
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
Incomplete output displayed and [Done] exited with code=null #171
Comments
For quick turnaround, you could use below setting ( {
"code-runner.runInTerminal": true
} Also, you may try below setting to run: {
"code-runner.executorMap.python": "python -u"
} Are those options working for you? |
Same issue, and the first option works.
|
The first option suggested successfully displays every print statement in the example above in the Terminal window, every time.
The second option suggested has the original issue displayed in the Output window.
|
I'm not a Javascript/NodeJS programmer, but I did some reading of the code in this extension, as well as the NodeJS API, and think I may have come across something interesting. I see that the exec() fucntion of child_process is being used in the executeCommandInOutputChannel() function in the codeManager.ts file. I'm understanding that exec() spawns a shell and executes the command within that shell, buffering any generated output. There is a maxBuffer option that is documented as:
https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback It looks as though the spawn() function should be used instead, since the data is streamed as standard IO objects -- not buffered strings. |
You Could Make It Thanks Man. I'm Facing A Similar Problem Where The Code Just Goes On And On . . . And Only When I Click Ctrl+Alt+M Does The Execution Stop.
|
Same problem in PHP! First option works too... |
Same problem python vsc windows 10 |
First option works. Thanks for the answer. 👌 |
This issue can lead to pretty nasty problems (debugging-wise) if one decides to e.g. create some output files and print some lengthy message about it on stout in the same loop. What happens is, SILENTLY, some of the files will go missing. Consider the below Python example: for i in range(1, 4501):
prefix = "debug/vscodetest/"
suffix = ".txt"
path = "{}{}{}".format(prefix, str(i), suffix)
with open(path, mode="w") as f:
f.write("Hello world!")
print("#{} file printed {}".format(str(i), "padding"*3)) It only takes to change In my case I first thought it was some strange problem with Python (performance issue, stout redirection I used not working properly etc.), then that it probably is some strange problem with VS Code and at last after one day at work spent on this I finally landed here. I think the problem at least merits some more visibility (maybe its own separate issue?) |
The same have happened to me, but in my case after applying your suggestions (specially the one of running Python script in the Terminal), I can see the starting point of the output |
Did Oleg Hwang get an answer to this question as I have same question exactly and can only find the question and no answer? |
If you run the code in the terminal then it works. Usually, it is a buffer issue and your terminal will have a larger buffer. |
First option works
Works for VS code running python; note further that the output window was not printing in a 'co-moving' fashion so I couldn't see the output as it went along. Thanks. |
@formulahendry could you take a look at #428? |
Fixed in v0.9.13. Thanks @JeffreyCA !! |
When running a program with lots of console output, I'm getting a "[Done] exited with code=null in 0.0XX seconds" before all of the output has actually been written to the console.
Below is a simple Python3 example to reproduce the problem. Each time the code is run, the console output will enumerate to a different count value before it stops with the code=null exit code.
The output window displays...
If I run the same example in the Visual Studio Code terminal window, the full expected output is displayed every time.
The text was updated successfully, but these errors were encountered: