| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c41ed59 commit 667f7a7
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -321,6 +321,8 @@ void Agent::EnqueueMessage(AgentMessage* message) { | |||
| 321 | 321 | void Agent::MessageHandler(const v8::Debug::Message& message) { | |
| 322 | 322 | Isolate* isolate = message.GetIsolate(); | |
| 323 | 323 | Environment* env = Environment::GetCurrent(isolate); | |
| 324 | + if (env == nullptr) | ||
| 325 | + return; // Called from a non-node context. | ||
| 324 | 326 | Agent* a = env->debugger_agent(); | |
| 325 | 327 | CHECK_NE(a, nullptr); | |
| 326 | 328 | CHECK_EQ(isolate, a->parent_env()->isolate()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const spawn = require('child_process').spawn; | ||
| 6 | + | ||
| 7 | + const args = [`--debug`, `--debug-port=${common.PORT}`, `--interactive`]; | ||
| 8 | + const proc = spawn(process.execPath, args, { stdio: 'pipe' }); | ||
| 9 | + proc.stdin.write(` | ||
| 10 | + util.inspect(Promise.resolve(42)); | ||
| 11 | + util.inspect(Promise.resolve(1337)); | ||
| 12 | + .exit | ||
| 13 | + `); | ||
| 14 | + proc.on('exit', common.mustCall((exitCode, signalCode) => { | ||
| 15 | + assert.strictEqual(exitCode, 0); | ||
| 16 | + assert.strictEqual(signalCode, null); | ||
| 17 | + })); | ||
| 18 | + let stdout = ''; | ||
| 19 | + proc.stdout.setEncoding('utf8'); | ||
| 20 | + proc.stdout.on('data', data => stdout += data); | ||
| 21 | + process.on('exit', () => { | ||
| 22 | + assert(stdout.includes('Promise { 42 }')); | ||
| 23 | + assert(stdout.includes('Promise { 1337 }')); | ||
| 24 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments