{"id":16934430,"url":"https://github.com/codeskyblue/kexec","last_synced_at":"2025-03-22T12:31:42.864Z","repository":{"id":57482680,"uuid":"45953171","full_name":"codeskyblue/kexec","owner":"codeskyblue","description":"Killable os/exec for golang library.","archived":false,"fork":false,"pushed_at":"2018-01-19T01:57:32.000Z","size":454,"stargazers_count":21,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T11:05:39.923Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeskyblue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-11T01:51:40.000Z","updated_at":"2024-12-27T07:03:06.000Z","dependencies_parsed_at":"2022-09-02T06:21:26.578Z","dependency_job_id":null,"html_url":"https://github.com/codeskyblue/kexec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fkexec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fkexec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fkexec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeskyblue%2Fkexec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeskyblue","download_url":"https://codeload.github.com/codeskyblue/kexec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959442,"owners_count":20538625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-13T20:52:09.499Z","updated_at":"2025-03-22T12:31:42.463Z","avatar_url":"https://github.com/codeskyblue.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# kexec\r\n[![GoDoc](https://godoc.org/github.com/codeskyblue/kexec?status.svg)](https://godoc.org/github.com/codeskyblue/kexec)\r\n\r\nThis is a golang lib, add a `Terminate` command to exec.\r\n\r\nTested on _windows, linux, darwin._\r\n\r\nThis lib has been used in [fswatch](https://github.com/codeskyblue/fswatch).\r\n\r\n## Usage\r\n\r\n```\r\ngo get -v github.com/codeskyblue/kexec\r\n```\r\n\r\n\r\nexample1:\r\n\r\n```go\r\npackage main\r\n\r\nimport \"github.com/codeskyblue/kexec\"\r\n\r\nfunc main(){\r\n\tp := kexec.Command(\"python\", \"flask_main.py\")\r\n\tp.Start()\r\n\tp.Terminate(syscall.SIGINT)\r\n}\r\n```\r\n\t\r\nexample2: see more [examples](examples)\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/codeskyblue/kexec\"\r\n)\r\n\r\nfunc main() {\r\n\t// In unix will call: bash -c \"python flask_main.py\"\r\n\t// In windows will call: cmd /c \"python flask_main.py\"\r\n\tp := kexec.CommandString(\"python flask_main.py\")\r\n\tp.Stdout = os.Stdout\r\n\tp.Stderr = os.Stderr\r\n\tp.Start()\r\n\tp.Terminate(syscall.SIGKILL)\r\n}\r\n```\r\n\r\nexample3:\r\n\r\n```go\r\npackage main\r\n\r\nimport \"github.com/codeskyblue/kexec\"\r\n\r\nfunc main() {\r\n\tp := kexec.Command(\"whoami\")\r\n\tp.SetUser(\"codeskyblue\") // Only works on darwin and linux\r\n\tp.Run()\r\n}\r\n```\r\n\r\n## Command line usage \r\n```\r\n$ go get -v github.com/codeskyblue/kexec/cmds/kexec\r\n$ kexec python main.py\r\n# Ctrl+C\r\npython is terminating ...\r\n```\r\n\r\n## PS\r\nThis lib also support you call `Wait()` twice, which is not support by `os/exec`\r\n\r\n## LICENSE\r\n[MIT](LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fkexec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeskyblue%2Fkexec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeskyblue%2Fkexec/lists"}