{"id":37166168,"url":"https://github.com/miguel-dorta/si","last_synced_at":"2026-01-14T19:41:32.273Z","repository":{"id":57511359,"uuid":"238752836","full_name":"Miguel-Dorta/si","owner":"Miguel-Dorta","description":"Single Instance: keep just one instance of your program","archived":false,"fork":false,"pushed_at":"2020-04-11T23:56:51.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T02:47:25.714Z","etag":null,"topics":["execution","singleton","unique"],"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/Miguel-Dorta.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":"2020-02-06T18:10:11.000Z","updated_at":"2024-06-20T02:47:25.715Z","dependencies_parsed_at":"2022-08-29T05:20:24.378Z","dependency_job_id":null,"html_url":"https://github.com/Miguel-Dorta/si","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Miguel-Dorta/si","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miguel-Dorta%2Fsi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miguel-Dorta%2Fsi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miguel-Dorta%2Fsi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miguel-Dorta%2Fsi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Miguel-Dorta","download_url":"https://codeload.github.com/Miguel-Dorta/si/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miguel-Dorta%2Fsi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","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":["execution","singleton","unique"],"created_at":"2026-01-14T19:41:31.471Z","updated_at":"2026-01-14T19:41:32.269Z","avatar_url":"https://github.com/Miguel-Dorta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# si\nSingle Instance: keep just one instance of your program.\n\n[![Build Status](https://dev.azure.com/Miguel-Dorta/si/_apis/build/status/Miguel-Dorta.si?branchName=master)](https://dev.azure.com/Miguel-Dorta/si/_build/latest?definitionId=1\u0026branchName=master)\n[![GoDoc](https://godoc.org/github.com/Miguel-Dorta/si?status.svg)](https://pkg.go.dev/github.com/Miguel-Dorta/si)\n\n## Description\nsi is a Go(Lang) package that helps you to find and communicate with other instances of your program.\n\n## Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/Miguel-Dorta/si\"\n\t\"os\"\n)\n\nfunc main() {\n\t// Example 1: Register your instance and exit if there's another one running\n\tif err := si.Register(\"my awesome program\"); err != nil {\n\t\tif err == si.ErrOtherInstanceRunning {\n\t\t\tfmt.Println(\"There's another instance running, bye!\")\n\t\t\tos.Exit(0)\n\t\t}\n\t\tfmt.Println(\"Error registering instance: \" + err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// Example 2: Find another instance and kill it\n\tp, err := si.Find(\"my awesome program\")\n\tif err != nil {\n\t\tfmt.Println(\"Error finding another instance: \" + err.Error())\n\t\tos.Exit(1)\n\t}\n\tif p == nil {\n\t\tfmt.Println(\"No other instance was found, bye!\")\n\t\tos.Exit(0)\n\t}\n\tp.process.Kill()\n}\n```\n\n### Important\nIf you want to communicate with your program using si.Process.StdXPipe(), this should have a pipe asigned to its stdX, else it will have /dev/null as default. This makes impossible the communication between processes. See [si/test/test.go/createInstance2()](https://github.com/Miguel-Dorta/si/blob/1689b65dcb56c7849fb21539e922639b6a76ded9/test/test.go#L61) to see an example.\n\n#### Meme\n![meme of a mexican dog saying \"si\"](https://i.nth.sh/media/4mM4w8KV46/DZCVdlgff1.jpeg \"si\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguel-dorta%2Fsi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiguel-dorta%2Fsi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguel-dorta%2Fsi/lists"}