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

Exception thrown causing incomplete output to console #311

Closed
danielkcz opened this issue Mar 16, 2014 · 7 comments
Closed

Exception thrown causing incomplete output to console #311

danielkcz opened this issue Mar 16, 2014 · 7 comments
Labels
needs more info not enough information in issue to debug windows

Comments

@danielkcz
Copy link

Alright, I am not sure if this isn't purely Windows issue and I don't have option to test anywhere else. Given this really simple code:

console.log('Calling console.log');
console.error('Calling console.error');
console.log('Calling console.log second time - fails');
console.error('Calling console.error second time - fails');
nonexisting.throwError();

When I run it directly like node server.js it works just fine, all 4 messages are displayed followed by exception details. However running nodemon server.js gives me just this:

16 Mar 20:38:56 - [nodemon] starting `node server.js`
Calling console.log
Calling console.error

S:\workspace\server.js:5
nonexisting.throwError();
^
ReferenceError: nonexisting is not defined
......
16 Mar 20:38:56 - [nodemon] app crashed - waiting for file changes before starting...

What could be possibly causing this ? It doesn't make any sense... Of course commenting out that last error line displays all messages correctly.

It would not be that big deal, but thing is, that adding Coffeescript to the mix with nodemon server.coffee swallows whole exception too (maybe worth another issue submit). I am trying to utilize debug utility to have nice verbose log of what is happening in the app. Currently everything is just blind with no clue where the error occurred.

Oh and adding process.on('uncaughtException', ... somewhat fixes JS version, but Coffee version is still broken same way :( Not that it's solution I like, I want to handle exceptions on my own, but I am talking mainly about development times here and when something slips out.

@remy
Copy link
Owner

remy commented Mar 18, 2014

Can you share the output of the version with just node server.js for comparison?

@danielkcz
Copy link
Author

Sure...

Calling console.log
Calling console.error
Calling console.log second time - fails
Calling console.error second time - fails

S:\workspace\server.js:5
nonexisting.throwError();
^
ReferenceError: nonexisting is not defined
.....

I had also made post to Stackoverflow just more focused around Coffeescript solution which is somewhat more serious. There is already one answer that could be right.

@remy
Copy link
Owner

remy commented Mar 18, 2014

Can you also paste the output of nodemon --dump server.js?

@danielkcz
Copy link
Author

S:\workspace>nodemon --dump server.js
18 Mar 23:48:55 - [nodemon] v1.0.15
18 Mar 23:48:55 - [nodemon] to restart at any time, enter `rs`
18 Mar 23:48:55 - [nodemon] watching: *.*
--------------
{ run: false,
  system:
   { cwd: 'S:\\workspace',
     useFind: false,
     useWatch: true,
     useWatchFile: false },
  required: false,
  dirs: [ 'S:\\workspace' ],
  timeout: 1000,
  options:
   { scriptPosition: 0,
     dump: true,
     script: 'server.js',
     args: [],
     ignore:
      [ '.git',
        'node_modules/**/node_modules',
        re: /\.git|node_modules/.*.*/node_modules/ ],
     watch: [ '*.*', re: /.*\..*/ ],
     restartable: 'rs',
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     verbose: false,
     stdout: true,
     execOptions:
      { script: 'server.js',
        exec: 'node',
        nodeArgs: undefined,
        ext: 'js',
        env: {},
        execArgs: [] },
     ext: 'js',
     monitor: [ '*.*', '!.git', '!node_modules/**/node_modules' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  command:
   { raw: { executable: 'node', args: [ 'server.js' ] },
     string: 'node server.js' } }
--------------
OS: win32 x64
node: v0.10.26
nodemon: v1.0.15
cwd: S:\workspace
command: node D:\users\Fredy\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js --dump server.js
--------------

@remy
Copy link
Owner

remy commented Mar 20, 2014

Got a fix being tested on windows today for this issue.

remy added a commit that referenced this issue Mar 20, 2014
We don't use pipe by default for stdio spawn, we look at how nodemon is being used, the either decide to use pipe or process.stdout/err. Then depending on whether nodemon is required, we then attach to the different stdout/err streams as required.
@remy
Copy link
Owner

remy commented Mar 20, 2014

Fixed in nodemon@1.0.17

@remy remy closed this as completed Mar 20, 2014
@danielkcz
Copy link
Author

Sounds promising, I will check it out, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info not enough information in issue to debug windows
Projects
None yet
Development

No branches or pull requests

2 participants