| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,20 +19,21 @@ const filename = path.join(tmpdir.path, 'node.heapsnapshot'); | |||
| 19 | 19 | const opts = { cwd: tmpdir.path }; | |
| 20 | 20 | const cli = startCLI([fixtures.path('debugger/empty.js')], [], opts); | |
| 21 | 21 | ||
| 22 | - function onFatal(error) { | ||
| 23 | - cli.quit(); | ||
| 24 | - throw error; | ||
| 22 | + async function waitInitialBreak() { | ||
| 23 | + try { | ||
| 24 | + await cli.waitForInitialBreak(); | ||
| 25 | + await cli.waitForPrompt(); | ||
| 26 | + await cli.command('takeHeapSnapshot()'); | ||
| 27 | + JSON.parse(readFileSync(filename, 'utf8')); | ||
| 28 | + // Check that two simultaneous snapshots don't step all over each other. | ||
| 29 | + // Refs: https://github.com/nodejs/node/issues/39555 | ||
| 30 | + await cli.command('takeHeapSnapshot(); takeHeapSnapshot()'); | ||
| 31 | + JSON.parse(readFileSync(filename, 'utf8')); | ||
| 32 | + } finally { | ||
| 33 | + await cli.quit(); | ||
| 34 | + } | ||
| 25 | 35 | } | |
| 26 | 36 | ||
| 27 | 37 | // Check that the snapshot is valid JSON. | |
| 28 | - return cli.waitForInitialBreak() | ||
| 29 | - .then(() => cli.waitForPrompt()) | ||
| 30 | - .then(() => cli.command('takeHeapSnapshot()')) | ||
| 31 | - .then(() => JSON.parse(readFileSync(filename, 'utf8'))) | ||
| 32 | - // Check that two simultaneous snapshots don't step all over each other. | ||
| 33 | - // Refs: https://github.com/nodejs/node/issues/39555 | ||
| 34 | - .then(() => cli.command('takeHeapSnapshot(); takeHeapSnapshot()')) | ||
| 35 | - .then(() => JSON.parse(readFileSync(filename, 'utf8'))) | ||
| 36 | - .then(() => cli.quit()) | ||
| 37 | - .then(null, onFatal); | ||
| 38 | + waitInitialBreak().then(common.mustCall()); | ||
| 38 | 39 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments