1

I'm having trouble using nodegit (v0.9.0). Any .js script that requires the package will hang forever and not exit. Example:

var nodegit = require('nodegit');

console.log("hello world");

Running this on the command line will result in the expected console output, but the script will never exit. I need to use ctrl-C to get control back from the script.

However, if I comment out the require statement:

// var nodegit = require('nodegit');

console.log("hello world");

Things work just fine.

I've encountered this behaviour on both Windows (7) and Linux (CentOS 7.1.1503). Both machines using v4.2.0 of node. I'm guessing that this is not a bug, and that I'm misusing the library somehow, but I don't understand what I could be doing wrong.

laffoyb
  • 1,540
  • 3
  • 22
  • 35

1 Answers1

2

It's a bug.

To work around the problem, you can call process.exit() when you're sure there's no more pending I/O.

Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
  • 1
    FYI, things that will prevent a node process from existing include a pending timer or interval (that has not had `.unref()` called on it) or a live server listening for incoming connections or an open socket. – jfriend00 Jan 26 '16 at 22:03