File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,35 @@ import { ExecutorResponseInterface } from '../interfaces/executor-response.inter
44import { ExecutorConfigInterface } from '../interfaces/executor-config.interface' ;
55import { join } from 'path' ;
66
7+ function convertNullToEmptyString ( obj ) {
8+ if ( obj === null ) {
9+ return "" ;
10+ }
11+
12+ if ( Array . isArray ( obj ) ) {
13+ return obj . map ( convertNullToEmptyString ) ;
14+ }
15+
16+ if ( typeof obj === 'object' ) {
17+ const newObj = { } ;
18+ for ( const key in obj ) {
19+ if ( obj . hasOwnProperty ( key ) ) {
20+ newObj [ key ] = convertNullToEmptyString ( obj [ key ] ) ;
21+ }
22+ }
23+ return newObj ;
24+ }
25+
26+ return obj ;
27+ }
28+
729export async function executorTask (
830 command : string ,
931 job : Job ,
1032 options ?: ExecutorConfigInterface ,
1133) : Promise < ExecutorResponseInterface > {
1234 return new Promise ( ( resolve , reject ) => {
13- const jobDataArg = JSON . stringify ( job . data ) ;
35+ const jobDataArg = JSON . stringify ( convertNullToEmptyString ( job . data ) ) ;
1436 // const escapedJobDataArg = `'${jobDataArg.replace(/'/g, "'\\''")}'`;
1537
1638 try {
You can’t perform that action at this time.
0 commit comments