From 12af72f75419d76971dc3c467b202f96ac84a4ee Mon Sep 17 00:00:00 2001 From: msivasubramaniaan Date: Sun, 10 Dec 2023 19:53:09 +0530 Subject: [PATCH] add findstr when windows machine Signed-off-by: msivasubramaniaan --- src/oc/ocWrapper.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/oc/ocWrapper.ts b/src/oc/ocWrapper.ts index 0a043af2c..bf34f95db 100644 --- a/src/oc/ocWrapper.ts +++ b/src/oc/ocWrapper.ts @@ -9,6 +9,7 @@ import * as tmp from 'tmp'; import { CommandOption, CommandText } from '../base/command'; import { CliChannel } from '../cli'; import { ClusterType, KubernetesConsole } from './types'; +import { Platform } from '../util/platform'; /** * A wrapper around the `oc` CLI tool. @@ -376,8 +377,9 @@ export class Oc { * @returns true if the current cluster is an OpenShift cluster, and false otherwise */ public async isOpenShiftCluster(): Promise { + const find = Platform.OS !== 'win32' ? 'grep' : 'FINDSTR'; try { - const result = await CliChannel.getInstance().executeTool(new CommandText('oc api-resources | grep openshift')); + const result = await CliChannel.getInstance().executeTool(new CommandText(`oc api-resources | ${find} openshift`)); if (result.stdout.length === 0) { return false; }