| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c5a6559 commit 0b90b07
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ env: | |||
| 5 | 5 | es6: true | |
| 6 | 6 | ||
| 7 | 7 | parserOptions: | |
| 8 | - ecmaVersion: 2016 | ||
| 8 | + ecmaVersion: 2017 | ||
| 9 | 9 | ||
| 10 | 10 | rules: | |
| 11 | 11 | # Possible Errors | |
@@ -139,3 +139,9 @@ globals: | |||
| 139 | 139 | DTRACE_HTTP_SERVER_RESPONSE: false | |
| 140 | 140 | DTRACE_NET_SERVER_CONNECTION: false | |
| 141 | 141 | DTRACE_NET_STREAM_END: false | |
| 142 | + LTTNG_HTTP_CLIENT_REQUEST: false | ||
| 143 | + LTTNG_HTTP_CLIENT_RESPONSE: false | ||
| 144 | + LTTNG_HTTP_SERVER_REQUEST: false | ||
| 145 | + LTTNG_HTTP_SERVER_RESPONSE: false | ||
| 146 | + LTTNG_NET_SERVER_CONNECTION: false | ||
| 147 | + LTTNG_NET_STREAM_END: false | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1 +1,2 @@ | |||
| 1 | 1 | registry=https://registry.npmjs.org | |
| 2 | + package-lock=false | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,17 @@ | |||
| 1 | + ### 1.11.5 | ||
| 2 | + | ||
| 3 | + * Fix eslint issues - **[@jkrems](https://github.com/jkrems)** [#63](https://github.com/nodejs/node-inspect/pull/63) | ||
| 4 | + - [`2adadbc`](https://github.com/nodejs/node-inspect/commit/2adadbc1086d2e374c425acbf96260a122705db2) **style:** Fix eslint issues | ||
| 5 | + - [`a6d2f88`](https://github.com/nodejs/node-inspect/commit/a6d2f882c026409696a1b063ff40ceba7e1ddb86) **doc:** Remove redundant newline at the end | ||
| 6 | + | ||
| 7 | + | ||
| 8 | + ### 1.11.4 | ||
| 9 | + | ||
| 10 | + * Handle blocked port - **[@jkrems](https://github.com/jkrems)** [#62](https://github.com/nodejs/node-inspect/pull/62) | ||
| 11 | + - [`3388969`](https://github.com/nodejs/node-inspect/commit/3388969d0032a78ff0cdb8146f170b978ec13b7b) **chore:** Disable package-lock | ||
| 12 | + - [`d278b23`](https://github.com/nodejs/node-inspect/commit/d278b233ae5e11a2b62d01ccbaae594f39b32a96) **fix:** Stop asking to report a blocked port - see: [#60](https://github.com/nodejs/node-inspect/issues/60) | ||
| 13 | + | ||
| 14 | + | ||
| 1 | 15 | ### 1.11.3 | |
| 2 | 16 | ||
| 3 | 17 | * [`93caa0f`](https://github.com/nodejs/node-inspect/commit/93caa0f5267c7ab452b258d3b03329a0bb5ac7f7) **docs:** Add missing oc in protocol | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,6 +42,13 @@ const [ InspectClient, createRepl ] = | |||
| 42 | 42 | ||
| 43 | 43 | const debuglog = util.debuglog('inspect'); | |
| 44 | 44 | ||
| 45 | + class StartupError extends Error { | ||
| 46 | + constructor(message) { | ||
| 47 | + super(message); | ||
| 48 | + this.name = 'StartupError'; | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 45 | 52 | function portIsFree(host, port, timeout = 2000) { | |
| 46 | 53 | if (port === 0) return Promise.resolve(); // Binding to a random port. | |
| 47 | 54 | ||
@@ -51,7 +58,7 @@ function portIsFree(host, port, timeout = 2000) { | |||
| 51 | 58 | return new Promise((resolve, reject) => { | |
| 52 | 59 | setTimeout(() => { | |
| 53 | 60 | didTimeOut = true; | |
| 54 | - reject(new Error( | ||
| 61 | + reject(new StartupError( | ||
| 55 | 62 | `Timeout (${timeout}) waiting for ${host}:${port} to be free`)); | |
| 56 | 63 | }, timeout); | |
| 57 | 64 | ||
@@ -346,10 +353,14 @@ function startInspect(argv = process.argv.slice(2), | |||
| 346 | 353 | stdin.resume(); | |
| 347 | 354 | ||
| 348 | 355 | function handleUnexpectedError(e) { | |
| 349 | - console.error('There was an internal error in node-inspect. ' + | ||
| 350 | - 'Please report this bug.'); | ||
| 351 | - console.error(e.message); | ||
| 352 | - console.error(e.stack); | ||
| 356 | + if (!(e instanceof StartupError)) { | ||
| 357 | + console.error('There was an internal error in node-inspect. ' + | ||
| 358 | + 'Please report this bug.'); | ||
| 359 | + console.error(e.message); | ||
| 360 | + console.error(e.stack); | ||
| 361 | + } else { | ||
| 362 | + console.error(e.message); | ||
| 363 | + } | ||
| 353 | 364 | if (inspector.child) inspector.child.kill(); | |
| 354 | 365 | process.exit(1); | |
| 355 | 366 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "name": "node-inspect", | |
| 3 | - "version": "1.11.3", | ||
| 3 | + "version": "1.11.5", | ||
| 4 | 4 | "description": "Node Inspect", | |
| 5 | 5 | "license": "MIT", | |
| 6 | 6 | "main": "lib/_inspect.js", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | + const Path = require('path'); | ||
| 3 | + const { createServer } = require('net'); | ||
| 4 | + | ||
| 2 | 5 | const { test } = require('tap'); | |
| 3 | 6 | ||
| 4 | 7 | const startCLI = require('./start-cli'); | |
@@ -23,3 +26,29 @@ test('launch w/ invalid host:port', (t) => { | |||
| 23 | 26 | t.equal(code, 1, 'exits with non-zero exit code'); | |
| 24 | 27 | }); | |
| 25 | 28 | }); | |
| 29 | + | ||
| 30 | + test('launch w/ unavailable port', async (t) => { | ||
| 31 | + const blocker = createServer((socket) => socket.end()); | ||
| 32 | + const port = await new Promise((resolve, reject) => { | ||
| 33 | + blocker.on('error', reject); | ||
| 34 | + blocker.listen(0, '127.0.0.1', () => resolve(blocker.address().port)); | ||
| 35 | + }); | ||
| 36 | + | ||
| 37 | + try { | ||
| 38 | + const script = Path.join('examples', 'three-lines.js'); | ||
| 39 | + const cli = startCLI([`--port=${port}`, script]); | ||
| 40 | + const code = await cli.quit(); | ||
| 41 | + | ||
| 42 | + t.notMatch( | ||
| 43 | + cli.output, | ||
| 44 | + 'report this bug', | ||
| 45 | + 'Omits message about reporting this as a bug'); | ||
| 46 | + t.match( | ||
| 47 | + cli.output, | ||
| 48 | + `waiting for 127.0.0.1:${port} to be free`, | ||
| 49 | + 'Tells the user that the port wasn\'t available'); | ||
| 50 | + t.equal(code, 1, 'exits with non-zero exit code'); | ||
| 51 | + } finally { | ||
| 52 | + blocker.close(); | ||
| 53 | + } | ||
| 54 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments