@@ -114,7 +114,7 @@ export default class ClusterViewLoader {
114114 const memoryFromSetting = vscode . workspace . getConfiguration ( 'openshiftConnector' ) . get ( 'crcMemoryAllocated' ) ;
115115 const nameserver = vscode . workspace . getConfiguration ( 'openshiftConnector' ) . get < string > ( 'crcNameserver' ) ;
116116 const nameserverOption = nameserver ? [ '-n' , nameserver ] : [ ] ;
117- const crcOptions = [ 'start' , '-p' , `${ pullSecretFromSetting } ` , '-c' , `${ cpuFromSetting } ` , '-m' , `${ memoryFromSetting } ` , ...nameserverOption , '-o json' ] ;
117+ const crcOptions = [ 'start' , '-p' , `${ pullSecretFromSetting } ` , '-c' , `${ cpuFromSetting } ` , '-m' , `${ memoryFromSetting } ` , ...nameserverOption , '-o' , ' json'] ;
118118
119119 startProcess = spawn ( `${ binaryFromSetting } ` , crcOptions ) ;
120120 channel . append ( `\n\n"${ binaryFromSetting } " ${ crcOptions . join ( ' ' ) } \n` ) ;
@@ -131,16 +131,18 @@ export default class ClusterViewLoader {
131131 channel . append ( chunk ) ;
132132 } ) ;
133133 startProcess . on ( 'close' , ( code ) => {
134- // eslint-disable-next-line no-console
135- console . log ( `crc start exited with code ${ code } ` ) ;
134+ const message = `'crc start' exited with code ${ code } ` ;
135+ channel . append ( message ) ;
136136 if ( code !== 0 ) {
137- panel . webview . postMessage ( { action : 'sendcrcstarterror' } )
137+ vscode . window . showErrorMessage ( message ) ;
138138 }
139139 const binaryLoc = event . isSetting ? vscode . workspace . getConfiguration ( 'openshiftConnector' ) . get ( 'crcBinaryLocation' ) : event . crcLoc ;
140140 ClusterViewLoader . checkCrcStatus ( binaryLoc , 'crcstartstatus' , panel ) ;
141141 } ) ;
142142 startProcess . on ( 'error' , ( err ) => {
143- console . log ( err ) ;
143+ const message = `'crc start' execution failed with error: '${ err . message } '` ;
144+ channel . append ( message ) ;
145+ vscode . window . showErrorMessage ( message ) ;
144146 } ) ;
145147 }
146148
@@ -153,28 +155,29 @@ export default class ClusterViewLoader {
153155 } else {
154156 filePath = event . data . tool ;
155157 }
156- try {
157- const stopProcess = spawn ( `${ filePath } ` , [ 'stop' ] ) ;
158- channel . append ( `\n\n"${ filePath } " stop\n` ) ;
159- stopProcess . stdout . setEncoding ( 'utf8' ) ;
160- stopProcess . stderr . setEncoding ( 'utf8' ) ;
161- stopProcess . stdout . on ( 'data' , ( chunk ) => {
162- channel . append ( chunk ) ;
163- } ) ;
164- stopProcess . stderr . on ( 'data' , ( chunk ) => {
165- channel . append ( chunk ) ;
166- } ) ;
167- stopProcess . on ( 'close' , ( code ) => {
168- // eslint-disable-next-line no-console
169- console . log ( `crc stop exited with code ${ code } ` ) ;
170- ClusterViewLoader . checkCrcStatus ( filePath , 'crcstopstatus' , panel ) ;
171- } ) ;
172- stopProcess . on ( 'error' , ( err ) => {
173- console . log ( err ) ;
174- } ) ;
175- } catch ( err ) {
176- console . log ( err ) ;
177- }
158+ const stopProcess = spawn ( `${ filePath } ` , [ 'stop' ] ) ;
159+ channel . append ( `\n\n"${ filePath } " stop\n` ) ;
160+ stopProcess . stdout . setEncoding ( 'utf8' ) ;
161+ stopProcess . stderr . setEncoding ( 'utf8' ) ;
162+ stopProcess . stdout . on ( 'data' , ( chunk ) => {
163+ channel . append ( chunk ) ;
164+ } ) ;
165+ stopProcess . stderr . on ( 'data' , ( chunk ) => {
166+ channel . append ( chunk ) ;
167+ } ) ;
168+ stopProcess . on ( 'close' , ( code ) => {
169+ const message = `'crc stop' exited with code ${ code } ` ;
170+ channel . append ( message ) ;
171+ if ( code !== 0 ) {
172+ vscode . window . showErrorMessage ( message ) ;
173+ }
174+ ClusterViewLoader . checkCrcStatus ( filePath , 'crcstopstatus' , panel ) ;
175+ } ) ;
176+ stopProcess . on ( 'error' , ( err ) => {
177+ const message = `'crc stop' execution filed with error: '${ err . message } '` ;
178+ channel . append ( message ) ;
179+ vscode . window . showErrorMessage ( message ) ;
180+ } ) ;
178181 }
179182
180183 static async crcSaveSettings ( event ) {
0 commit comments