@@ -19,33 +19,22 @@ const cbterminal = {
1919     * @param  {string } command - The command to be executed. 
2020     * @returns  {Promise<CommandOutput|CommandError> } A promise that resolves with the command's output, error, or finish signal. 
2121     */ 
22-     executeCommand : async  ( command :  string , executeInMain = false ) :  Promise < CommandOutput | CommandError >  =>  { 
22+     executeCommand : async  ( command :string ,   returnEmptyStringOnSuccess   =   false )  =>  { 
2323        return  new  Promise ( ( resolve ,  reject )  =>  { 
2424            cbws . getWebsocket . send ( JSON . stringify ( { 
2525                "type" : "executeCommand" , 
2626                "message" : command , 
27-                 executeInMain 
27+                 returnEmptyStringOnSuccess 
2828            } ) ) ; 
2929            let  result  =  "" ; 
30-             cbws . getWebsocket . on ( 'message' ,  ( data :  string )  =>  { 
30+             cbws . getWebsocket . on ( 'message' ,  ( data :string )  =>  { 
3131                const  response  =  JSON . parse ( data ) ; 
32-              
33-                 if  ( response . type  ===  "commandOutput"  ||  response . type  ===  "commandError"  ||  response . type  ===  "commandFinish" )  { 
34-                     if  ( response . type  ===  "commandOutput" )  { 
35-                         // Initialize result as an empty string                 
36-                         result  +=  response . stdout  +  "/n" ;  // Append the output 
37-                     }  else  if  ( response . type  ===  "commandError" )  { 
38-                         result  =  response . stderr  +  "/n" ; ;  // Set result to the error 
39-                         response . result  =  result ; 
40-                         resolve ( response ) ;  // Resolve with the result string 
41-                     }  else  if  ( response . type  ===  "commandFinish" )  { 
42-                         response . result  =  result ; 
43-                         resolve ( response ) ;  // Resolve with the result string 
44-                     } 
32+                 if  ( response . type  ===  "commandError"  ||  response . type  ===  "commandFinish"  )  { 
33+                    resolve ( response ) 
4534                } 
4635            } ) ; 
4736        } ) ; 
48-     } , 
37+     } , , 
4938
5039    /** 
5140     * Executes a given command and keeps running until an error occurs. 
0 commit comments