Skip to content
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

Node apps do not terminate in debug mode #11582

Closed
SteveShe opened this issue Sep 6, 2016 · 2 comments
Closed

Node apps do not terminate in debug mode #11582

SteveShe opened this issue Sep 6, 2016 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@SteveShe
Copy link

SteveShe commented Sep 6, 2016

  • VSCode Version: 1.4.0
  • OS Version: Windows 10586.545
    The script below should execute and terminate naturally, as it does from a command prompt. Under the VSCode debugger, it executes and then sits in the debugger.

Steps to Reproduce:

  1. Install Nodejs (4.5.0 or 6.5.0): https://nodejs.org/en/
  2. Install Tedious: http://tediousjs.github.io/tedious/installation.html
  3. Create an Azure database.
  4. Execute the following script.
var Connection = require('tedious').Connection;

var config = {  
    userName: 'user',  
    password: 'password',  
    server: 'server001.database.windows.net',  
    options: {encrypt: true, database: 'db001'}  
}

var connection = new Connection(config);
connection.on('error', function(err) {  
    if (err) {  
        console.log(err);
    }else {  
        console.log("Error called with no err object.");
    }  
});
// connection.on('debug', function(messagetext) {  
//     if (messagetext) {  
//         console.log('debugtext: ' + messagetext);
//     }else {  
//         console.log("Debug called with no messagetext object.");
//     }  
// });  
connection.on('connect', function(err) {
// If no error, then good to go...
    executeStatement();
    return;
}
);

var Request = require('tedious').Request;

  function executeStatement() {
    request = new Request("select 42, 'hello world'", function(err, rowCount) {
      if (err) {
        console.log(err);
      } else {
        console.log(rowCount + ' rows');
      }
      console.log('About to call connection.close().');      
      connection.close();
      console.log('Called connection.close().');
    });

    request.on('row', function(columns) {
      columns.forEach(function(column) {
        console.log(column.value);
      });
    });

    connection.execSql(request);
  }
@ramya-rao-a ramya-rao-a added debug Debug viewlet, configurations, breakpoints, adapter issues *question Issue represents a question, should be posted to StackOverflow (VS Code) labels Sep 6, 2016
@ramya-rao-a
Copy link
Contributor

This is not specific to the example code in question. A simple node app with a console.log('hello world'); behaves the same way. From a terminal, this would print hello world and terminate. In debug mode, it prints hello world and waits. Any particular reasoning behind this? @weinand @isidorn

@isidorn isidorn removed their assignment Sep 7, 2016
@weinand
Copy link
Contributor

weinand commented Sep 7, 2016

This is a long-standing node bug: nodejs/node#1788

It is independent from VS Code and you can reproduce it by running the 'hello world' oneliner from the command line with node --debug hello.js

@weinand weinand closed this as completed Sep 7, 2016
@weinand weinand added upstream Issue identified as 'upstream' component related (exists outside of VS Code) *duplicate Issue identified as a duplicate of another issue(s) and removed *question Issue represents a question, should be posted to StackOverflow (VS Code) labels Sep 7, 2016
@weinand weinand added this to the September 2016 milestone Sep 7, 2016
@ramya-rao-a ramya-rao-a changed the title Hang on Windows 10 under VSCode debugger when executing the example code. Node apps do not terminate in debug mode Sep 7, 2016
@weinand weinand added bug Issue identified by VS Code Team member as probable bug and removed *duplicate Issue identified as a duplicate of another issue(s) labels Apr 13, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants