Show error message of Signal Events unsupported on Windows #2904

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
5 participants

shigeki commented Mar 10, 2012

As discussed #1553, signal events are not yet supported on Windows.
The current error message of

process.on('SIGINT', function() {});

is shown on Windows as

C:\Users\ohtsu\Desktop\node\node>Release\node.exe test.js

node.js:197
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: No such module
    at EventEmitter.<anonymous> (node.js:388:27)
    at Object.<anonymous> (C:\Users\ohtsu\Desktop\node\node\test.js:1:71)
    at Module._compile (module.js:443:26)
    at Object..js (module.js:461:10)
    at Module.load (module.js:350:32)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:481:10)
    at EventEmitter._tickCallback (node.js:188:41)

The error description of "No such module" is too ambiguous for users.
This patch shows it more clearly as

C:\Users\ohtsu\Desktop\shigeki>Release\node.exe test.js

node.js:197
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Signal Event: SIGINT is not yet supported on Windows.
    at EventEmitter.<anonymous> (node.js:388:17)
    at Object.<anonymous> (C:\Users\ohtsu\Desktop\shigeki\test.js:1:71)
    at Module._compile (module.js:443:26)
    at Object..js (module.js:461:10)
    at Module.load (module.js:350:32)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:481:10)
    at EventEmitter._tickCallback (node.js:188:41)

I also add notes on doc that signal events are not yet supported on Windows.

@Southern Southern and 1 other commented on an outdated diff Mar 11, 2012

doc/api/process.markdown
@@ -55,6 +55,7 @@ stay running forever, `uncaughtException` can be a useful safety mechanism.
Emitted when the processes receives a signal. See sigaction(2) for a list of
standard POSIX signal names such as SIGINT, SIGUSR1, etc.
+Signal Events are not yet supported on Windows.
@Southern

Southern Mar 11, 2012

Should probably bold it to grab more attention. Had to put a couple of notes like this in readline's docs.

@shigeki

shigeki Mar 11, 2012

Thanks for the comment. I change the doc description into the same as that in readline. I think that there's no actual workaround on this for simulating this with key events through stdin depends on the key assignments by user, so I did not add the additional notes on it.

@Southern

Southern Mar 11, 2012

If your program uses readline, you can always bind to readline.on('SIGINT', ...). Readline picks up ^C through stdin keypresses.

@shigeki

shigeki Mar 12, 2012

I'm using the keypress event of Ctrl-c in stdin direcly. I agree that readline is the alternative.

Member

domenic commented Aug 1, 2012

+1, I believe this cryptic error message is what is preventing me from running the npm-www site on Windows.

domenic referenced this pull request in isaacs/cluster-master Aug 1, 2012

Closed

Wrap SIGHUP/SIGINT/SIGKILL listening in try/catch #1

@isaacs isaacs added a commit to isaacs/cluster-master that referenced this pull request Aug 3, 2012

@domenic @isaacs domenic + isaacs Wrap SIGHUP/SIGINT/SIGKILL listening in try/catch
Now the module can at least bootstrap itself without crashing on Windows.

Related: nodejs/node-v0.x-archive#2904
3b8a0ab

Can one of the admins verify this patch?

Member

domenic commented Sep 30, 2014

Was this fixed with a test?

@domenic This was closed because node supports SIGINT & SIGHUP, as tested locally on windows xp with node v0.10.30. The docs also reflect this change as of 155df9c. All platforms throw an error when listening for SIGKILL. I did not track down the changeset that changed the behavior on Windows, though -- I can if you'd like!

@gibfahn gibfahn pushed a commit to ibmruntimes/node that referenced this pull request Apr 26, 2016

@jasnell jasnell 2016-04-26, Version 6.0.0 (Current) Release
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](nodejs/node#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](nodejs/node#5048),
    [#4594](nodejs/node#4594)
  * Improved error handling [#4514](nodejs/node#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](nodejs/node#5361).
* Crypto
  * Improved error handling [#3100](nodejs/node#3100),
    [#5611](nodejs/node#5611)
  * Simplified Certificate class bindings
    [#5382](nodejs/node#5382)
  * Improved control over FIPS mode
    [#5181](nodejs/node#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](nodejs/node#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](nodejs/node#5775).
  * V8 updated to 5.0.71.31 [#6111](nodejs/node#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](nodejs/node#4921).
* Domains
  * Clear stack when no error handler
  [#4659](nodejs/node#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](nodejs/node#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](nodejs/node#5616).
  * Error handling and type checking improvements
    [#5616](nodejs/node#5616),
    [#5590](nodejs/node#5590),
    [#4518](nodejs/node#4518),
    [#3917](nodejs/node#3917).
  * fs.read's string interface is deprecated
    [#4525](nodejs/node#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](nodejs/node#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](nodejs/node#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](nodejs/node#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](nodejs/node#6021).
  * Improved error handling and type checking
    [#5981](nodejs/node#5981),
    [#5733](nodejs/node#5733),
    [#2904](nodejs/node#2904)
* Path
  * Improved type checking [#5348](nodejs/node#5348).
* Process
  * Introduce process warnings API
    [#4782](nodejs/node#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](nodejs/node#3860).
* Readline
  * Emit key info unconditionally
    [#6024](nodejs/node#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](nodejs/node#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](nodejs/node#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](nodejs/node#4557)
  * SHA1 used for sessionIdContext
    [#3866](nodejs/node#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](nodejs/node#2528).
* Util
  * Changes to Error object formatting
    [#4582](nodejs/node#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](nodejs/node#5167),
    [#5167](nodejs/node#5167).
f5f573f

@gibfahn gibfahn pushed a commit to ibmruntimes/node that referenced this pull request Apr 27, 2016

@jasnell jasnell 2016-04-26, Version 6.0.0 (Current) Release
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](nodejs/node#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](nodejs/node#5048),
    [#4594](nodejs/node#4594)
  * Improved error handling [#4514](nodejs/node#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](nodejs/node#5361).
* Crypto
  * Improved error handling [#3100](nodejs/node#3100),
    [#5611](nodejs/node#5611)
  * Simplified Certificate class bindings
    [#5382](nodejs/node#5382)
  * Improved control over FIPS mode
    [#5181](nodejs/node#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](nodejs/node#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](nodejs/node#5775).
  * V8 updated to 5.0.71.31 [#6111](nodejs/node#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](nodejs/node#4921).
* Domains
  * Clear stack when no error handler
  [#4659](nodejs/node#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](nodejs/node#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](nodejs/node#5616).
  * Error handling and type checking improvements
    [#5616](nodejs/node#5616),
    [#5590](nodejs/node#5590),
    [#4518](nodejs/node#4518),
    [#3917](nodejs/node#3917).
  * fs.read's string interface is deprecated
    [#4525](nodejs/node#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](nodejs/node#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](nodejs/node#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](nodejs/node#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](nodejs/node#6021).
  * Improved error handling and type checking
    [#5981](nodejs/node#5981),
    [#5733](nodejs/node#5733),
    [#2904](nodejs/node#2904)
* OS X
  * MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
    [#6402](nodejs/node#6402).
* Path
  * Improved type checking [#5348](nodejs/node#5348).
* Process
  * Introduce process warnings API
    [#4782](nodejs/node#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](nodejs/node#3860).
* Readline
  * Emit key info unconditionally
    [#6024](nodejs/node#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](nodejs/node#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](nodejs/node#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](nodejs/node#4557)
  * SHA1 used for sessionIdContext
    [#3866](nodejs/node#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](nodejs/node#2528).
* Util
  * Changes to Error object formatting
    [#4582](nodejs/node#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](nodejs/node#5167),
    [#5167](nodejs/node#5167).
ce3e3c5

@gibfahn gibfahn pushed a commit to ibmruntimes/node that referenced this pull request May 6, 2016

@jasnell jasnell 2016-04-26, Version 6.0.0 (Current) Release
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](nodejs/node#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](nodejs/node#5048),
    [#4594](nodejs/node#4594)
  * Improved error handling [#4514](nodejs/node#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](nodejs/node#5361).
* Crypto
  * Improved error handling [#3100](nodejs/node#3100),
    [#5611](nodejs/node#5611)
  * Simplified Certificate class bindings
    [#5382](nodejs/node#5382)
  * Improved control over FIPS mode
    [#5181](nodejs/node#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](nodejs/node#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](nodejs/node#5775).
  * V8 updated to 5.0.71.31 [#6111](nodejs/node#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](nodejs/node#4921).
* Domains
  * Clear stack when no error handler
  [#4659](nodejs/node#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](nodejs/node#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](nodejs/node#5616).
  * Error handling and type checking improvements
    [#5616](nodejs/node#5616),
    [#5590](nodejs/node#5590),
    [#4518](nodejs/node#4518),
    [#3917](nodejs/node#3917).
  * fs.read's string interface is deprecated
    [#4525](nodejs/node#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](nodejs/node#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](nodejs/node#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](nodejs/node#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](nodejs/node#6021).
  * Improved error handling and type checking
    [#5981](nodejs/node#5981),
    [#5733](nodejs/node#5733),
    [#2904](nodejs/node#2904)
* OS X
  * MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
    [#6402](nodejs/node#6402).
* Path
  * Improved type checking [#5348](nodejs/node#5348).
* Process
  * Introduce process warnings API
    [#4782](nodejs/node#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](nodejs/node#3860).
* Readline
  * Emit key info unconditionally
    [#6024](nodejs/node#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](nodejs/node#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](nodejs/node#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](nodejs/node#4557)
  * SHA1 used for sessionIdContext
    [#3866](nodejs/node#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](nodejs/node#2528).
* Util
  * Changes to Error object formatting
    [#4582](nodejs/node#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](nodejs/node#5167),
    [#5167](nodejs/node#5167).
1a29a57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment