question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incomplete output displayed and [Done] exited with code=null

See original GitHub issue

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.

for count in range(100000):
    print(count)

The output window displays…

...
37345
37346
37347
37348
37349
37
[Done] exited with code=null in 0.044 seconds

If I run the same example in the Visual Studio Code terminal window, the full expected output is displayed every time.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
sulbigcommented, Sep 1, 2017

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:

maxBuffer <number> : Largest amount of data in bytes allowed on stdout or stderr. (Default: 200*1024) If exceeded, the child process is terminated. See caveat at maxBuffer and Unicode.

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.

12reactions
formulahendrycommented, Aug 30, 2017

For quick turnaround, you could use below setting (File->Preference->Settings) to run code in Integrated Terminal:

{
    "code-runner.runInTerminal": true
}

Also, you may try below setting to run:

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

Are those options working for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

My VS CODE extension code runner isnt working
in my case solution was to uncheck "Show Execution Message" check box in Run Code configuration. setting.
Read more >
I'm getting an error in output "exited with code=1" in VS Code ...
I have written a neat code of Hello World program in VS code but when I click on run, it shows an error...
Read more >
concurrently - npm
I like task automation with npm but the usual way to run multiple commands concurrently is npm run watch-js & npm run watch-css...
Read more >
http_response_code - Manual - PHP
The above example will output: ... function http_response_code($code = NULL) { if ($code !== ... exit('Unknown http status code "' . htmlentities($code) ....
Read more >
picocli - a mighty tiny command line interface
n", user, base64(md.digest())); // null out the arrays when done Arrays.fill(bytes, ... invalid: missing file parameters <command> -n 123.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found