47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
---
|
|
name: detect_wsl
|
|
kind: function
|
|
lang: bash
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "detect_wsl([--check]) -> void"
|
|
description: "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."
|
|
tags: [bash, wsl, windows, detect, integration, pendiente-usar]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: []
|
|
params:
|
|
- name: --check
|
|
desc: "flag: solo detecta y retorna exit code sin producir output (0=WSL, 1=no WSL)"
|
|
output: "sin output con --check; informe del entorno WSL a stdout sin argumentos; exit code 1 si no es WSL"
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "bash/functions/infra/detect_wsl.sh"
|
|
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
|
|
source_license: "MIT"
|
|
source_file: "scripts/linux/gestion_linux/wsl_host.sh"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```bash
|
|
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).
|