@@ -14,15 +14,15 @@ import * as fs from 'fs';
1414import { pathExistsSync } from 'fs-extra' ;
1515import * as path from 'path' ;
1616import * as tempfile from 'tmp' ;
17- import { ProviderResult , QuickPickItem , Terminal , Uri , WorkspaceFolder , commands , workspace } from 'vscode' ;
17+ import { commands , ProviderResult , QuickPickItem , Terminal , Uri , workspace , WorkspaceFolder } from 'vscode' ;
1818import { CommandText } from './base/command' ;
1919import * as cliInstance from './cli' ;
20- import { CliExitData } from './cli' ;
2120import { Command } from './odo/command' ;
2221import { AnalyzeResponse , ComponentType , ComponentTypeAdapter , DevfileComponentType , Registry } from './odo/componentType' ;
2322import { ComponentDescription } from './odo/componentTypeDescription' ;
2423import { Project } from './odo/project' ;
2524import { ToolsConfig } from './tools' ;
25+ import { ChildProcessUtil , CliExitData } from './util/childProcessUtil' ;
2626import { KubeConfigUtils } from './util/kubeUtils' ;
2727import { Platform } from './util/platform' ;
2828import { WindowUtil } from './util/windowUtils' ;
@@ -58,14 +58,14 @@ export interface Odo {
5858 getProjects ( ) : Promise < Project [ ] > ;
5959 getCompTypesJson ( ) :Promise < DevfileComponentType [ ] > ;
6060 getComponentTypes ( ) : Promise < ComponentTypeAdapter [ ] > ;
61- execute ( command : CommandText , cwd ?: string , fail ?: boolean , addEnv ?: any ) : Promise < cliInstance . CliExitData > ;
61+ execute ( command : CommandText , cwd ?: string , fail ?: boolean , addEnv ?: any ) : Promise < CliExitData > ;
6262 executeInTerminal ( command : CommandText , cwd ?: string , name ?: string , addEnv ?: any ) : Promise < void > ;
6363 requireLogin ( ) : Promise < boolean > ;
6464 createProject ( name : string ) : Promise < void > ;
6565 deleteProject ( projectName : string ) : Promise < void > ;
6666 createComponentFromFolder ( type : string , registryName : string , name : string , path : Uri , starterName ?: string , useExistingDevfile ?: boolean , customDevfilePath ?: string ) : Promise < void > ;
6767 createService ( formData : any ) : Promise < void > ;
68- loadItems < I > ( result : cliInstance . CliExitData , fetch : ( data ) => I [ ] ) : I [ ] ;
68+ loadItems < I > ( result : CliExitData , fetch : ( data ) => I [ ] ) : I [ ] ;
6969 getRegistries ( ) : Promise < Registry [ ] > ;
7070 addRegistry ( name : string , url : string , token : string ) : Promise < Registry > ;
7171 removeRegistry ( name : string ) : Promise < void > ;
@@ -118,7 +118,6 @@ export interface Odo {
118118}
119119
120120export class OdoImpl implements Odo {
121- private static cli : cliInstance . Cli = cliInstance . CliChannel . getInstance ( ) ;
122121
123122 private static instance : Odo ;
124123
@@ -130,7 +129,7 @@ export class OdoImpl implements Odo {
130129 }
131130
132131 async getActiveCluster ( ) : Promise < string > {
133- const result : cliInstance . CliExitData = await this . execute (
132+ const result : CliExitData = await this . execute (
134133 Command . printOdoVersion ( ) , process . cwd ( ) , false
135134 ) ;
136135
@@ -183,15 +182,15 @@ export class OdoImpl implements Odo {
183182 }
184183
185184 public async getCompTypesJson ( ) : Promise < DevfileComponentType [ ] > {
186- const result : cliInstance . CliExitData = await this . execute ( Command . listCatalogComponentsJson ( ) , undefined , true , this . getKubeconfigEnv ( ) ) ;
185+ const result : CliExitData = await this . execute ( Command . listCatalogComponentsJson ( ) , undefined , true , this . getKubeconfigEnv ( ) ) ;
187186 const componentTypes : DevfileComponentType [ ] = this . loadJSON ( result . stdout ) ;
188187 return componentTypes ;
189188 }
190189
191190 public async getComponentTypes ( ) : Promise < ComponentType [ ] > {
192191 // if kc is produced, KUBECONFIG env var is empty or pointing
193192
194- const result : cliInstance . CliExitData = await this . execute ( Command . listCatalogComponentsJson ( ) , undefined , true , this . getKubeconfigEnv ( ) ) ;
193+ const result : CliExitData = await this . execute ( Command . listCatalogComponentsJson ( ) , undefined , true , this . getKubeconfigEnv ( ) ) ;
195194 const componentTypes : DevfileComponentType [ ] = this . loadJSON ( result . stdout ) ;
196195 const devfileItems : ComponentTypeAdapter [ ] = [ ] ;
197196
@@ -203,7 +202,7 @@ export class OdoImpl implements Odo {
203202 public async describeComponent ( contextPath : string , experimental = false ) : Promise < ComponentDescription | undefined > {
204203 const expEnv = experimental ? { ODO_EXPERIMENTAL_MODE : 'true' } : { } ;
205204 try {
206- const describeCmdResult : cliInstance . CliExitData = await this . execute (
205+ const describeCmdResult : CliExitData = await this . execute (
207206 Command . describeComponentJson ( ) , contextPath , false , expEnv
208207 ) ;
209208 return JSON . parse ( describeCmdResult . stdout ) as ComponentDescription ;
@@ -220,13 +219,13 @@ export class OdoImpl implements Odo {
220219 terminal . show ( ) ;
221220 }
222221
223- public async execute ( command : CommandText , cwd ?: string , fail = true , addEnv = { } ) : Promise < cliInstance . CliExitData > {
222+ public async execute ( command : CommandText , cwd ?: string , fail = true , addEnv = { } ) : Promise < CliExitData > {
224223 const env = cliInstance . CliChannel . createTelemetryEnv ( ) ;
225224 const commandActual = `${ command } ` ;
226225 const commandPrivacy = `${ command . privacyMode ( true ) } ` ;
227226 const [ cmd ] = commandActual . split ( ' ' ) ;
228227 const toolLocation = await ToolsConfig . detect ( cmd ) ;
229- const result : cliInstance . CliExitData = await OdoImpl . cli . execute (
228+ const result : CliExitData = await ChildProcessUtil . Instance . execute (
230229 toolLocation ? commandActual . replace ( cmd , `"${ toolLocation } "` ) : commandActual ,
231230 cwd ? { cwd, env : { ...env , ...addEnv } } : { env : { ...env , ...addEnv } }
232231 ) ;
@@ -293,7 +292,7 @@ export class OdoImpl implements Odo {
293292 return parse ;
294293 }
295294
296- public loadItems < I > ( result : cliInstance . CliExitData , fetch : ( data ) => I [ ] = ( data ) : I [ ] => data . items ) : I [ ] {
295+ public loadItems < I > ( result : CliExitData , fetch : ( data ) => I [ ] = ( data ) : I [ ] => data . items ) : I [ ] {
297296 let data : I [ ] = [ ] ;
298297 try {
299298 const items = fetch ( JSON . parse ( result . stdout ) ) ;
@@ -372,7 +371,7 @@ export class OdoImpl implements Odo {
372371
373372 public async canCreatePod ( ) : Promise < boolean > {
374373 try {
375- const result : cliInstance . CliExitData = await this . execute ( Command . canCreatePod ( ) ) ;
374+ const result : CliExitData = await this . execute ( Command . canCreatePod ( ) ) ;
376375 if ( result . stdout === 'yes' ) {
377376 return true ;
378377 }
@@ -384,7 +383,7 @@ export class OdoImpl implements Odo {
384383
385384 public async isPodmanPresent ( ) : Promise < boolean > {
386385 try {
387- const result : cliInstance . CliExitData = await this . execute ( Command . printOdoVersionJson ( ) ) ;
386+ const result : CliExitData = await this . execute ( Command . printOdoVersionJson ( ) ) ;
388387 if ( 'podman' in JSON . parse ( result . stdout ) ) {
389388 return true ;
390389 }
0 commit comments