Files
fn_registry/bash/functions/infra/detect_wsl.md
T
egutierrez 194663a379 feat: add bash infra installer and diagnostic functions
10 funciones Bash del dominio infra: instaladores de herramientas de desarrollo
(install_go, install_nodejs, install_pnpm, install_python312, install_uv,
install_volta, install_wails), diagnostico del sistema (analyze_disk_space,
detect_wsl, list_listening_ports). Automatizan la configuracion del entorno
de desarrollo en Linux/WSL.
2026-04-12 13:54:21 +02:00

1.5 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path, source_repo, source_license, source_file
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path source_repo source_license source_file
detect_wsl function bash infra 1.0.0 impure detect_wsl([--check]) -> void Detecta si el sistema es WSL (Windows Subsystem for Linux). Con --check retorna solo exit code (0=WSL, 1=no WSL) sin output. Sin argumentos imprime versión WSL, usuario Windows, distribución, hostname, unidades montadas y ruta Windows del directorio actual.
bash
wsl
windows
detect
integration
false error_go_core
name desc
--check flag: solo detecta y retorna exit code sin producir output (0=WSL, 1=no WSL)
sin output con --check; informe del entorno WSL a stdout sin argumentos; exit code 1 si no es WSL false
bash/functions/infra/detect_wsl.sh https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git MIT scripts/linux/gestion_linux/wsl_host.sh

Ejemplo

source bash/functions/infra/detect_wsl.sh

# Verificar si es WSL en scripts (sin output)
if detect_wsl --check; then
    echo "Estamos en WSL"
fi

# Mostrar información completa del entorno WSL
detect_wsl

Notas

Usa tres métodos de detección en orden: /proc/version, /proc/sys/kernel/osrelease, y la presencia de /mnt/c + WSLInterop. No incluye las acciones interactivas del script original (abrir PowerShell, CMD, Explorer, VS Code).