summaryrefslogtreecommitdiff
path: root/deps/node-inspect/lib/internal
diff options
context:
space:
mode:
authorJan Krems <jan.krems@groupon.com>2018-01-24 10:42:54 -0800
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-01 13:39:40 +0100
commit02b3bbc5e20e0d663c9e16d1617d78af10950905 (patch)
tree3a5a145e1190b646f3ce7bb8c1f2c8c34f5383f5 /deps/node-inspect/lib/internal
parent7ff4888ed2d99a7ea412b3dee46286a8754956c4 (diff)
downloadandroid-node-v8-02b3bbc5e20e0d663c9e16d1617d78af10950905.tar.gz
android-node-v8-02b3bbc5e20e0d663c9e16d1617d78af10950905.tar.bz2
android-node-v8-02b3bbc5e20e0d663c9e16d1617d78af10950905.zip
deps: update node-inspect to 1.11.3
Highlights: * Using a random port works (`node inspect --port=0 script.js`) * `takeHeapSnapshot()` creates valid snapshots again PR-URL: https://github.com/nodejs/node/pull/18354 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'deps/node-inspect/lib/internal')
-rw-r--r--deps/node-inspect/lib/internal/inspect_client.js10
-rw-r--r--deps/node-inspect/lib/internal/inspect_repl.js20
2 files changed, 16 insertions, 14 deletions
diff --git a/deps/node-inspect/lib/internal/inspect_client.js b/deps/node-inspect/lib/internal/inspect_client.js
index c247e2add8..9b8529de21 100644
--- a/deps/node-inspect/lib/internal/inspect_client.js
+++ b/deps/node-inspect/lib/internal/inspect_client.js
@@ -164,12 +164,12 @@ function decodeFrameHybi17(data) {
}
class Client extends EventEmitter {
- constructor(port, host) {
+ constructor() {
super();
this.handleChunk = this._handleChunk.bind(this);
- this._port = port;
- this._host = host;
+ this._port = undefined;
+ this._host = undefined;
this.reset();
}
@@ -284,7 +284,9 @@ class Client extends EventEmitter {
});
}
- connect() {
+ connect(port, host) {
+ this._port = port;
+ this._host = host;
return this._discoverWebsocketPath()
.then((urlPath) => this._connectWebsocket(urlPath));
}
diff --git a/deps/node-inspect/lib/internal/inspect_repl.js b/deps/node-inspect/lib/internal/inspect_repl.js
index 937c1843d3..38fe4684cf 100644
--- a/deps/node-inspect/lib/internal/inspect_repl.js
+++ b/deps/node-inspect/lib/internal/inspect_repl.js
@@ -900,10 +900,8 @@ function createRepl(inspector) {
return new Promise((resolve, reject) => {
const absoluteFile = Path.resolve(filename);
const writer = FS.createWriteStream(absoluteFile);
- let totalSize;
let sizeWritten = 0;
function onProgress({ done, total, finished }) {
- totalSize = total;
if (finished) {
print('Heap snaphost prepared.');
} else {
@@ -913,13 +911,18 @@ function createRepl(inspector) {
function onChunk({ chunk }) {
sizeWritten += chunk.length;
writer.write(chunk);
- print(`Writing snapshot: ${sizeWritten}/${totalSize}`, true);
- if (sizeWritten >= totalSize) {
- writer.end();
+ print(`Writing snapshot: ${sizeWritten}`, true);
+ }
+ function onResolve() {
+ writer.end(() => {
teardown();
print(`Wrote snapshot: ${absoluteFile}`);
resolve();
- }
+ });
+ }
+ function onReject(error) {
+ teardown();
+ reject(error);
}
function teardown() {
HeapProfiler.removeListener(
@@ -932,10 +935,7 @@ function createRepl(inspector) {
print('Heap snapshot: 0/0', true);
HeapProfiler.takeHeapSnapshot({ reportProgress: true })
- .then(null, (error) => {
- teardown();
- reject(error);
- });
+ .then(onResolve, onReject);
});
},