{"id":19651078,"url":"https://github.com/mnutt/redirect-stdio","last_synced_at":"2025-07-22T21:03:12.478Z","repository":{"id":196368820,"uuid":"695968711","full_name":"mnutt/redirect-stdio","owner":"mnutt","description":"Utilities for redirecting node process stdout and stderr.","archived":false,"fork":false,"pushed_at":"2023-09-24T18:57:04.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T01:25:47.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/mnutt.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}},"created_at":"2023-09-24T18:49:45.000Z","updated_at":"2024-04-29T02:33:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"6102c2b5-f93a-4790-9a7f-ebf949d5d405","html_url":"https://github.com/mnutt/redirect-stdio","commit_stats":null,"previous_names":["mnutt/redirect-stdio"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mnutt/redirect-stdio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnutt%2Fredirect-stdio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnutt%2Fredirect-stdio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnutt%2Fredirect-stdio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnutt%2Fredirect-stdio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnutt","download_url":"https://codeload.github.com/mnutt/redirect-stdio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnutt%2Fredirect-stdio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266572294,"owners_count":23949994,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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-11-11T15:05:09.981Z","updated_at":"2025-07-22T21:03:12.451Z","avatar_url":"https://github.com/mnutt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redirect-stdio\n\nUtilities for redirecting node process stdout and stderr.\n\nNote: Only works on MacOS and Linux.\n\n## Motivation\n\nImagine you have a node app that logs to stdout and a bash script that\nruns your node process like this:\n\n```\nnode myapp.js \u003e\u003e access.log\n```\n\nLater, you want to add logrotate, which moves `access.log` to\n`access.log.2` and then calls `SIGUSR2` on your node process. But your\nnode process is logging to stdout, and can't exactly \"reopen\"\n`process.stdout`.\n\nWith `redirect-stio`, you can:\n* use `pathFromFd` to find where your process's stdout is actually going\n* on `SIGUSR2`, re-open the log path you just found, and write that file\ndescriptor over the old one to rotate logs\n\n## Usage\n\n```javascript\nconst { reopenStdout, reopenStderr } = require('redirect-stdio');\n\nprocess.on('SIGUSR2', function() {\n  reopenStdout();\n  reopenStderr();\n});\n```\n\n## License\n\nCopyright 2023 Movable, Inc. See LICENSE.md.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnutt%2Fredirect-stdio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnutt%2Fredirect-stdio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnutt%2Fredirect-stdio/lists"}