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>
2.0 KiB
2.0 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 | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bash_safe_run | function | bash | shell | 1.0.0 | impure | safe_run(cmd: string, [error_code: string], [error_desc: string]) -> void; setup_error_trap() -> void; error_trap_handler(exit_code: int, line_number: int) -> void | Ejecuta comandos con manejo de errores integrado. Incluye trap handler que captura fallos con numero de linea y codigo de salida. |
|
|
false | error_go_core |
|
exit code 0 si el comando tuvo exito; exit code 1 con mensaje de error formateado si fallo | false | bash/functions/shell/bash_safe_run.sh | https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git | MIT | scripts/lib/common.sh |
Ejemplo
source bash/functions/shell/bash_safe_run.sh
bash_log_init
setup_error_trap
safe_run "go build ./..." "BUILD_FAILED" "La compilacion fallo"
safe_run "docker compose up -d" "DOCKER_FAILED" "No se pudo iniciar Docker Compose"
safe_run "npm install" "NPM_FAILED"
Notas
safe_run usa eval internamente para ejecutar el comando, lo que permite pasar comandos con pipes y redirecciones como string. Usar con precaucion en entornos con input no confiable.
setup_error_trap instala un trap ERR que llama a error_trap_handler automaticamente en cualquier comando fallido del script, mostrando numero de linea y codigo de salida.
error_trap_handler no llama a exit — el caller decide si continuar o abortar. Muestra la ruta al log para debugging.