{"id":35212102,"url":"https://github.com/mugomes/mgrun","last_synced_at":"2026-03-27T02:42:08.626Z","repository":{"id":331001658,"uuid":"1124799482","full_name":"mugomes/mgrun","owner":"mugomes","description":"MGRun é um wrapper leve em Go para exec que simplifica a execução de comandos do shell com suporte nativo a callbacks em tempo real para as saídas de sistema.","archived":false,"fork":false,"pushed_at":"2025-12-29T18:21:14.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-01T21:34:27.658Z","etag":null,"topics":["exec","go","golang","process","shell","subprocess"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mugomes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["mugomes"],"custom":["https://www.mugomes.com.br/p/apoie.html"]}},"created_at":"2025-12-29T16:27:52.000Z","updated_at":"2025-12-29T18:21:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mugomes/mgrun","commit_stats":null,"previous_names":["mugomes/mgrun"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mugomes/mgrun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgrun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgrun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgrun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgrun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mugomes","download_url":"https://codeload.github.com/mugomes/mgrun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mugomes%2Fmgrun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31011485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:33:22.146Z","status":"ssl_error","status_checked_at":"2026-03-27T02:33:21.763Z","response_time":164,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exec","go","golang","process","shell","subprocess"],"created_at":"2025-12-29T19:21:40.425Z","updated_at":"2026-03-27T02:42:08.618Z","avatar_url":"https://github.com/mugomes.png","language":"Go","funding_links":["https://github.com/sponsors/mugomes","https://www.mugomes.com.br/p/apoie.html"],"categories":[],"sub_categories":[],"readme":"# MGRun\n\n**MGRun** é um wrapper leve e multiplataforma em Go para execução de comandos do sistema, projetado para simplificar o uso de `exec` com **captura de saída em tempo real**, **callbacks** e **controle seguro de concorrência**.\n\nIdeal para aplicações CLI, ferramentas de automação, instaladores, utilitários desktop e sistemas que precisam acompanhar a execução de comandos enquanto eles ainda estão rodando.\n\n---\n\n## ✨ Recursos\n\n* 🌍 **Multiplataforma**\n  Abstrai automaticamente a execução entre:\n\n  * PowerShell (Windows)\n  * SH (Linux e macOS)\n\n* 📡 **Streaming em tempo real**\n  Receba cada linha de `stdout` e `stderr` via callbacks enquanto o processo executa.\n\n* 🧵 **Thread-safe**\n  Leitura concorrente segura das streams e controle confiável do processo.\n\n* 🏠 **Ambiente herdado**\n\n  * Executa comandos a partir do diretório *Home* do usuário\n  * Herda variáveis de ambiente do sistema\n  * Permite adicionar variáveis customizadas\n\n* 🔁 **Código de saída acessível**\n  Obtenha o *exit code* após a finalização do processo.\n\n---\n\n## 📦 Instalação\n\n```bash\ngo get github.com/mugomes/mgrun\n```\n\n---\n\n## 🚀 Exemplo de uso\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/mugomes/mgrun\"\n)\n\nfunc main() {\n\tsRun := mgrun.New(\"ls -a\")\n\n\t// Definir diretório de execução (opcional)\n\tpathHome, _ := os.UserHomeDir()\n\tsRun.SetDir(pathHome)\n\n\t// Variáveis de ambiente extras (opcional)\n\tsRun.AddEnv(\"EXEMPLO\", \"Valor\")\n\n\t// Callback para stderr\n\tsRun.OnStderr(func(line string) {\n\t\tfmt.Printf(\"[STDERR]: %s\\n\", line)\n\t})\n\n\t// Callback para stdout\n\tsRun.OnStdout(func(line string) {\n\t\tfmt.Printf(\"[STDOUT]: %s\\n\", line)\n\t})\n\n\t// Executa o comando\n\tif err := sRun.Run(); err != nil {\n\t\tfmt.Printf(\"Erro na execução: %v\\n\", err)\n\t}\n\n\tfmt.Printf(\"Exit Code: %d\\n\", sRun.ExitCode())\n}\n```\n\n---\n\n## ⚙️ Requisitos\n\n* **Go** 1.25.5 ou superior\n* **PowerShell** (apenas no Windows)\n\n---\n\n## 🖥️ Sistemas Operacionais\n\n* ✔️ Linux\n* ✔️ Windows\n* ✔️ macOS (Darwin)\n\n---\n\n## 👤 Autor\n\n**Murilo Gomes Julio**\n\n🔗 [https://mugomes.github.io](https://mugomes.github.io)\n\n📺 [https://youtube.com/@mugomesoficial](https://youtube.com/@mugomesoficial)\n\n---\n\n## License\n\nCopyright (c) 2025-2026 Murilo Gomes Julio\n\nLicensed under the [MIT](https://github.com/mugomes/mgrun/blob/main/LICENSE) license.\n\nAll contributions to the MGRun are subject to this license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugomes%2Fmgrun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmugomes%2Fmgrun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmugomes%2Fmgrun/lists"}