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");
2
2
const { performance } = require ( "perf_hooks" ) ;
3
3
const { NodeVM } = require ( "vm2" ) ;
4
4
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
+ }
6
22
// Do not delete!
7
23
//
8
24
// Used to catch asynchronous exceptions from inside of CodeRun that will otherwise
@@ -14,8 +30,9 @@ process.on("uncaughtException", () => {
14
30
15
31
class CodeRun extends BaseAction {
16
32
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 ( ) ;
19
36
const vm = new NodeVM ( {
20
37
timeout : 60000 ,
21
38
eval : false ,
You can’t perform that action at this time.
0 commit comments