{"id":20961344,"url":"https://github.com/perbu/executor","last_synced_at":"2026-04-21T08:03:16.780Z","repository":{"id":244233308,"uuid":"814648424","full_name":"perbu/executor","owner":"perbu","description":"Wrapper around os.Exec()","archived":false,"fork":false,"pushed_at":"2024-06-13T12:28:45.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T18:27:31.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perbu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-06-13T12:22:54.000Z","updated_at":"2024-06-13T12:28:48.000Z","dependencies_parsed_at":"2024-06-13T15:05:33.841Z","dependency_job_id":null,"html_url":"https://github.com/perbu/executor","commit_stats":null,"previous_names":["perbu/executor"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/perbu/executor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fexecutor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fexecutor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fexecutor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fexecutor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perbu","download_url":"https://codeload.github.com/perbu/executor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perbu%2Fexecutor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32082781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2024-11-19T02:03:25.282Z","updated_at":"2026-04-21T08:03:16.743Z","avatar_url":"https://github.com/perbu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# executor\n\nA Go package to execute shell scripts in a temporary file and return stdout, stderr and exit code.\n\n## Installation\n\n```\ngo get github.com/perbu/executor\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/perbu/executor\"\n)\n\nfunc main() {\n    script := []byte(\"#!/bin/sh\\necho 'Hello, World!'\\n\")\n    err := executor.Execute(script)\n    if err != nil {\n        fmt.Printf(\"Error executing script: %v\\n\", err)\n        if execErr, ok := err.(*executor.ErrExecute); ok {\n            fmt.Printf(\"Stdout: %s\\n\", execErr.Stdout)\n            fmt.Printf(\"Stderr: %s\\n\", execErr.Stderr)\n            fmt.Printf(\"Exit code: %d\\n\", execErr.ExitCode)\n        }\n    }\n}\n```\n\n## Error Handling\n\nIf the script fails to execute, `Execute` will return an `ErrExecute` error which contains:\n- `SubError`: The underlying error that caused the execution to fail\n- `Stdout`: The contents of stdout \n- `Stderr`: The contents of stderr\n- `ExitCode`: The exit code of the script\n\nYou can type assert the returned error to `ErrExecute` to access these fields:\n\n```go\nif execErr, ok := err.(*executor.ErrExecute); ok {\n    fmt.Printf(\"Stdout: %s\\n\", execErr.Stdout) \n    fmt.Printf(\"Stderr: %s\\n\", execErr.Stderr)\n    fmt.Printf(\"Exit code: %d\\n\", execErr.ExitCode)\n}\n```\n\n## Testing\n\nThe package includes unit tests covering success and error scenarios. To run the tests:\n\n```\ngo test ./...\n```\n\n## License \n\nSee LICENSE.md\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fexecutor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperbu%2Fexecutor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperbu%2Fexecutor/lists"}