File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,23 @@ const { BaseAction } = require("./BaseAction");
22const { performance } = require ( "perf_hooks" ) ;
33const { NodeVM } = require ( "vm2" ) ;
44
5- process . on ( "uncaughtException" , ( ) => {
5+ let resolve = null ;
6+ let t0 = 0 ;
7+
8+ process . on ( "uncaughtException" , ( e ) => {
9+ if ( resolve ) {
10+ resolve ( {
11+ actionReports : [
12+ {
13+ action : "Code.run" ,
14+ success : false ,
15+ shortSummary : e . message || e ,
16+ longSummary : null ,
17+ time : performance . now ( ) - t0 ,
18+ } ,
19+ ] ,
20+ } ) ;
21+ }
622 // Do not delete!
723 //
824 // Used to catch asynchronous exceptions from inside of CodeRun that will otherwise
@@ -14,8 +30,9 @@ process.on("uncaughtException", () => {
1430
1531class CodeRun extends BaseAction {
1632 async eval ( context ) {
17- return new Promise ( ( resolve ) => {
18- const t0 = performance . now ( ) ;
33+ return new Promise ( ( _resolve ) => {
34+ resolve = _resolve ;
35+ t0 = performance . now ( ) ;
1936 const vm = new NodeVM ( {
2037 timeout : 60000 ,
2138 eval : false ,
You can’t perform that action at this time.
0 commit comments