{"id":16003433,"url":"https://github.com/nhatthm/go-exec","last_synced_at":"2026-02-21T03:32:48.698Z","repository":{"id":146425761,"uuid":"617189717","full_name":"nhatthm/go-exec","owner":"nhatthm","description":"Runs external commands","archived":false,"fork":false,"pushed_at":"2025-03-22T08:23:00.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T00:32:15.493Z","etag":null,"topics":["cli","command","command-line","command-line-tool","commands","exec","go","golang"],"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/nhatthm.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},"funding":{"github":"nhatthm","custom":"donate.nhat.me"}},"created_at":"2023-03-21T21:49:35.000Z","updated_at":"2025-03-22T08:21:35.000Z","dependencies_parsed_at":"2023-11-29T10:27:18.737Z","dependency_job_id":"149be414-7c8b-4221-8d17-1f6f90352eac","html_url":"https://github.com/nhatthm/go-exec","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/nhatthm/go-exec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatthm%2Fgo-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatthm%2Fgo-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatthm%2Fgo-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatthm%2Fgo-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nhatthm","download_url":"https://codeload.github.com/nhatthm/go-exec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatthm%2Fgo-exec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29672704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T03:11:15.450Z","status":"ssl_error","status_checked_at":"2026-02-21T03:10:34.920Z","response_time":107,"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":["cli","command","command-line","command-line-tool","commands","exec","go","golang"],"created_at":"2024-10-08T10:20:31.903Z","updated_at":"2026-02-21T03:32:48.678Z","avatar_url":"https://github.com/nhatthm.png","language":"Go","funding_links":["https://github.com/sponsors/nhatthm","donate.nhat.me","https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY"],"categories":[],"sub_categories":[],"readme":"# Exec\n\n[![GitHub Releases](https://img.shields.io/github/v/release/nhatthm/go-exec)](https://github.com/nhatthm/go-exec/releases/latest)\n[![Build Status](https://github.com/nhatthm/go-exec/actions/workflows/test.yaml/badge.svg)](https://github.com/nhatthm/go-exec/actions/workflows/test.yaml)\n[![codecov](https://codecov.io/gh/nhatthm/go-exec/branch/master/graph/badge.svg?token=eTdAgDE2vR)](https://codecov.io/gh/nhatthm/go-exec)\n[![Go Report Card](https://goreportcard.com/badge/go.nhat.io/exec)](https://goreportcard.com/report/go.nhat.io/exec)\n[![GoDevDoc](https://img.shields.io/badge/dev-doc-00ADD8?logo=go)](https://pkg.go.dev/go.nhat.io/exec)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)\n\nPackage `exec` runs external commands.\n\n## Prerequisites\n\n- `Go \u003e= 1.22`\n\n## Install\n\n```bash\ngo get go.nhat.io/exec\n```\n\n## Usage\n\nRun a command:\n\n```go\npackage example_test\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\n\t\"go.nhat.io/exec\"\n)\n\nfunc ExampleRun() {\n\toutBuf := new(bytes.Buffer)\n\terrBuf := new(bytes.Buffer)\n\n\t_, err := exec.Run(\"echo\", exec.WithArgs(\"hello world\"),\n\t\texec.WithStdout(outBuf),\n\t\texec.WithStderr(errBuf),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(outBuf.String())\n\tfmt.Println(errBuf.String())\n\n\t// Output:\n\t// hello world\n\t//\n}\n```\n\nRun a command with pipes:\n\n```go\npackage example_test\n\nimport (\n    \"bytes\"\n    \"fmt\"\n\n    \"go.nhat.io/exec\"\n)\n\nfunc ExampleRun_pipe() {\n\toutBuf := new(bytes.Buffer)\n\terrBuf := new(bytes.Buffer)\n\n\t_, err := exec.Run(\"echo\", exec.WithArgs(\"hello world\"),\n\t\texec.WithStdout(outBuf),\n\t\texec.WithStderr(errBuf),\n\t\texec.Pipe(\"grep\", \"-o\", \"hello\"),\n\t\texec.Pipe(\"tr\", \"[:lower:]\", \"[:upper:]\"),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(outBuf.String())\n\tfmt.Println(errBuf.String())\n\n\t// Output:\n\t// HELLO\n\t//\n}\n```\n\n## Donation\n\nIf this project help you reduce time to develop, you can give me a cup of coffee :)\n\n### Paypal donation\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;or scan this\n\n\u003cimg src=\"https://user-images.githubusercontent.com/1154587/113494222-ad8cb200-94e6-11eb-9ef3-eb883ada222a.png\" width=\"147px\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhatthm%2Fgo-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhatthm%2Fgo-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhatthm%2Fgo-exec/lists"}