Skip to content

Commit

Permalink
add findstr when windows machine (#3715)
Browse files Browse the repository at this point in the history
Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
  • Loading branch information
msivasubramaniaan authored Dec 11, 2023
1 parent 3d60d1e commit 9efcd13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/oc/ocWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -376,8 +377,9 @@ export class Oc {
* @returns true if the current cluster is an OpenShift cluster, and false otherwise
*/
public async isOpenShiftCluster(): Promise<boolean> {
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;
}
Expand Down

0 comments on commit 9efcd13

Please sign in to comment.