55
66import * as fs from 'fs/promises' ;
77import * as JSYAML from 'js-yaml' ;
8+ import { platform } from 'os' ;
89import * as path from 'path' ;
910import { which } from 'shelljs' ;
1011import { commands , debug , DebugConfiguration , DebugSession , Disposable , EventEmitter , extensions , ProgressLocation , Uri , window , workspace } from 'vscode' ;
@@ -15,6 +16,7 @@ import { CommandProvider, StarterProject } from '../odo/componentTypeDescription
1516import { Odo } from '../odo/odoWrapper' ;
1617import { ComponentWorkspaceFolder } from '../odo/workspace' ;
1718import sendTelemetry , { NewComponentCommandProps } from '../telemetry' ;
19+ import { ChildProcessUtil , CliExitData } from '../util/childProcessUtil' ;
1820import { Progress } from '../util/progress' ;
1921import { vsCommand , VsCommandError } from '../vscommand' ;
2022import AddServiceBindingViewLoader , { ServiceBindingFormResponse } from '../webview/add-service-binding/addServiceBindingViewLoader' ;
@@ -217,11 +219,20 @@ export class Component extends OpenShiftItem {
217219 }
218220
219221 private static async checkForPodman ( ) : Promise < boolean > {
220- if ( await Component . odo . isPodmanPresent ( ) ) {
221- return true ;
222- }
223- const podmanOnPath = which ( 'podman' ) ;
224- if ( podmanOnPath ) {
222+ const podmanPath = which ( 'podman' ) ;
223+ if ( podmanPath ) {
224+ if ( platform ( ) === 'linux' ) {
225+ return true ;
226+ }
227+ try {
228+ const resultRaw : CliExitData = await ChildProcessUtil . Instance . execute ( `"${ podmanPath } " machine list --format json` ) ;
229+ const resultObj : { Running : boolean } [ ] = JSON . parse ( resultRaw . stdout ) ;
230+ if ( resultObj . length === 1 && resultObj [ 0 ] . Running ) {
231+ return true ;
232+ }
233+ } catch ( e ) {
234+ // do nothing; something is wrong with the podman setup
235+ }
225236 const SETUP_INSTRUCTIONS = 'Open setup instructions' ;
226237 void window . showErrorMessage ( 'Podman is present on the system, but is not fully set up yet.' , SETUP_INSTRUCTIONS )
227238 . then ( result => {
0 commit comments