{"id":15393873,"url":"https://github.com/mitchellh/panicwrap","last_synced_at":"2025-10-11T05:31:41.460Z","repository":{"id":9899414,"uuid":"11906240","full_name":"mitchellh/panicwrap","owner":"mitchellh","description":"panicwrap is a Go library for catching and handling panics in Go applications.","archived":true,"fork":false,"pushed_at":"2024-04-05T14:22:42.000Z","size":52,"stargazers_count":450,"open_issues_count":13,"forks_count":71,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-10-10T17:56:53.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc","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/mitchellh.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-05T19:00:46.000Z","updated_at":"2025-06-03T09:04:08.000Z","dependencies_parsed_at":"2024-06-18T12:19:26.411Z","dependency_job_id":"1e2da20c-3e16-4dcb-84e0-375f0745efd7","html_url":"https://github.com/mitchellh/panicwrap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mitchellh/panicwrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fpanicwrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fpanicwrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fpanicwrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fpanicwrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/panicwrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fpanicwrap/sbom","scorecard":{"id":650250,"data":{"date":"2025-08-11","repo":{"name":"github.com/mitchellh/panicwrap","commit":"b3f3dc3c6bac25d9aa700825f5dc0dba75c5f2a8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":4,"reason":"Found 10/22 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T13:19:49.353Z","repository_id":9899414,"created_at":"2025-08-21T13:19:49.353Z","updated_at":"2025-08-21T13:19:49.353Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006320,"owners_count":26084085,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-01T15:20:38.583Z","updated_at":"2025-10-11T05:31:41.181Z","avatar_url":"https://github.com/mitchellh.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# panicwrap\n\npanicwrap is a Go library that re-executes a Go binary and monitors stderr\noutput from the binary for a panic. When it finds a panic, it executes a\nuser-defined handler function. Stdout, stderr, stdin, signals, and exit\ncodes continue to work as normal, making the existence of panicwrap mostly\ninvisible to the end user until a panic actually occurs.\n\nSince a panic is truly a bug in the program meant to crash the runtime,\nglobally catching panics within Go applications is not supposed to be possible.\nDespite this, it is often useful to have a way to know when panics occur.\npanicwrap allows you to do something with these panics, such as writing them\nto a file, so that you can track when panics occur.\n\npanicwrap is ***not a panic recovery system***. Panics indicate serious\nproblems with your application and _should_ crash the runtime. panicwrap\nis just meant as a way to monitor for panics. If you still think this is\nthe worst idea ever, read the section below on why.\n\n## Features\n\n* **SIMPLE!**\n* Works with all Go applications on all platforms Go supports\n* Custom behavior when a panic occurs\n* Stdout, stderr, stdin, exit codes, and signals continue to work as\n  expected.\n\n## Usage\n\nUsing panicwrap is simple. It behaves a lot like `fork`, if you know\nhow that works. A basic example is shown below.\n\nBecause it would be sad to panic while capturing a panic, it is recommended\nthat the handler functions for panicwrap remain relatively simple and well\ntested. panicwrap itself contains many tests.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/mitchellh/panicwrap\"\n\t\"os\"\n)\n\nfunc main() {\n\texitStatus, err := panicwrap.BasicWrap(panicHandler)\n\tif err != nil {\n\t\t// Something went wrong setting up the panic wrapper. Unlikely,\n\t\t// but possible.\n\t\tpanic(err)\n\t}\n\n\t// If exitStatus \u003e= 0, then we're the parent process and the panicwrap\n\t// re-executed ourselves and completed. Just exit with the proper status.\n\tif exitStatus \u003e= 0 {\n\t\tos.Exit(exitStatus)\n\t}\n\n\t// Otherwise, exitStatus \u003c 0 means we're the child. Continue executing as\n\t// normal...\n\n\t// Let's say we panic\n\tpanic(\"oh shucks\")\n}\n\nfunc panicHandler(output string) {\n\t// output contains the full output (including stack traces) of the\n\t// panic. Put it in a file or something.\n\tfmt.Printf(\"The child panicked:\\n\\n%s\\n\", output)\n\tos.Exit(1)\n}\n```\n\n## How Does it Work?\n\npanicwrap works by re-executing the running program (retaining arguments,\nenvironmental variables, etc.) and monitoring the stderr of the program.\nSince Go always outputs panics in a predictable way with a predictable\nexit code, panicwrap is able to reliably detect panics and allow the parent\nprocess to handle them.\n\n## WHY?! Panics should CRASH!\n\nYes, panics _should_ crash. They are 100% always indicative of bugs and having\ninformation on a production server or application as to what caused the panic is critical.\n\n### User Facing\n\nIn user-facing programs (programs like\n[Packer](http://github.com/mitchellh/packer) or\n[Docker](http://github.com/dotcloud/docker)), it is up to the user to\nreport such panics. This is unreliable, at best, and it would be better if the\nprogram could have a way to automatically report panics. panicwrap provides\na way to do this.\n\n### Server\n\nFor backend applications, it is easier to detect crashes (since the application exits) \nand having an idea as to why the crash occurs is equally important; \nparticularly on a production server. \n\nAt [HashiCorp](http://www.hashicorp.com),\nwe use panicwrap to log panics to timestamped files with some additional\ndata (configuration settings at the time, environmental variables, etc.)\n\nThe goal of panicwrap is _not_ to hide panics. It is instead to provide\na clean mechanism for capturing them and ultimately crashing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fpanicwrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fpanicwrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fpanicwrap/lists"}