crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 242 forks source link

shell_windows: Detect shell under ssh #4401

Closed albfan closed 1 month ago

albfan commented 1 month ago

Fixes: Issue #3582

Solution/Idea

$env:SHELL not empty is not definitive to detect shell terminal

Proposed changes

Reuse our logic to detect powershell if current result is not definitive.

Testing

Use crc oc-env under ssh on windows

fixes #3582

openshift-ci[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign cfergeau for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/crc-org/crc/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
praveenkumar commented 1 month ago

Check https://github.com/praveenkumar/crc/commit/1efb9fa52cf85a56246e5489fc21851715464d91 one I think it would be more clear and we don't have to pass the process pid to helper function.

albfan commented 1 month ago

Many thanks for review Praveen.

Just to avoid go into further check, I added a default result to identify non detected shell

praveenkumar commented 1 month ago

Looks like CI is failing because of fmt error run make fmt .

openshift-ci[bot] commented 1 month ago

@albfan: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/integration-crc 8c303664eecae6412d5dab633a997d5665af42d1 link true /test integration-crc
ci/prow/e2e-crc 8c303664eecae6412d5dab633a997d5665af42d1 link true /test e2e-crc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
albfan commented 1 month ago

@praveenkumar should be fixed now. I find with goimports but not sure where CI show that error