Skip to content

[WSL2] getWslSSHAddress would fail on busybox distros #3242

Closed
@arixmkii

Description

@arixmkii

Description

The command line used is not universally supported:

cmd := exec.Command("wsl.exe", "-d", distroName, "bash", "-c", `hostname -I | cut -d ' ' -f1`)

Example output from Alpine:

~$ hostname -I
hostname: unrecognized option: I
BusyBox v1.37.0 (2024-12-13 21:18:49 UTC) multi-call binary.

Usage: hostname [-sidf] [HOSTNAME | -F FILE]

Show or set hostname or DNS domain name

        -s      Short
        -i      Addresses for the hostname
        -d      DNS domain name
        -f      Fully qualified domain name
        -F FILE Use FILE's content as hostname
~$ echo $?
1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions