diff --git a/microscript/ILibDuktape_ReadableStream.c b/microscript/ILibDuktape_ReadableStream.c index ea9ff54..d4f8f5a 100644 --- a/microscript/ILibDuktape_ReadableStream.c +++ b/microscript/ILibDuktape_ReadableStream.c @@ -400,6 +400,7 @@ int ILibDuktape_readableStream_WriteDataEx(ILibDuktape_readableStream *stream, i { if (ILibIsRunningOnChainThread(stream->chain)) { + duk_context *cx = stream->ctx; ILibDuktape_EventEmitter_SetupEmit(stream->ctx, stream->object, "data"); // [emit][this][data] if (streamReserved == 0) { @@ -417,7 +418,7 @@ int ILibDuktape_readableStream_WriteDataEx(ILibDuktape_readableStream *stream, i ILibDuktape_Process_UncaughtException(stream->ctx); } - duk_pop(stream->ctx); // ... + duk_pop(cx); // ... } else { diff --git a/modules/agent-selftest.js b/modules/agent-selftest.js index a621dbc..370574a 100644 --- a/modules/agent-selftest.js +++ b/modules/agent-selftest.js @@ -577,6 +577,38 @@ function testCoreDump() { var pid = c; console.log(' -> Agent PID = ' + c); + + var p = ret.self.agentQueryValue("require('monitor-info').kvm_x11_support"); + if (promise.wait(p).toString() != 'true') + { + // No KVM Support, so just do a plain dump test + var nextp = new promise(function (r, j) { this._res = r; this._rej = j; }); + global.agentipc_next = nextp + console.log(' -> Initiating plain dump test'); + ret.self.consoleCommand("eval require('MeshAgent').restartCore();"); + try + { + promise.wait(nextp); + ret.self.agentQueryValue('process.pid').then(function (cc) + { + if (cc == pid) + { + console.log(' -> Core Restarted without crashing..[OK]'); + ret._res(); + } + else + { + ret._rej(' -> Core Restart resulted in crash...[FAILED]'); + } + }); + } + catch (z) + { + ret._rej(' -> ERROR', z); + } + return; + } + console.log(' -> Initiating KVM for dump test'); ret.tunnel = this.self.createTunnel(0x1FF, 0x00); ret.tunnel.then(function (c) @@ -903,6 +935,11 @@ function testTerminal(terminalMode) if (!require('monitor-info').kvm_x11_support) { consent = 0x00; } } } + else + { + var p = this.agentQueryValue("require('monitor-info').kvm_x11_support"); + if (promise.wait(p).toString() != 'true') { consent = 0x00; } + } ret.tunnel = this.createTunnel(0x1FF, consent); ret.mode = terminalMode.toString();