{"id":16270814,"url":"https://github.com/craigwardman/subspawn","last_synced_at":"2025-03-19T23:30:56.397Z","repository":{"id":64960370,"uuid":"579940952","full_name":"craigwardman/subspawn","owner":"craigwardman","description":"An npm library for spawning (and killing) synchronous and asynchronous sub processes from node.","archived":false,"fork":false,"pushed_at":"2023-11-02T09:36:34.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T21:41:03.425Z","etag":null,"topics":["child-process","node","process"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/craigwardman.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":"2022-12-19T10:22:01.000Z","updated_at":"2023-11-01T17:37:48.000Z","dependencies_parsed_at":"2023-02-08T10:02:00.485Z","dependency_job_id":"60c3a9b3-00a1-4f91-be68-5e0e515443f8","html_url":"https://github.com/craigwardman/subspawn","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"f12b26cff51b75b91fe03fd573fdc3a7e629a449"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2Fsubspawn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2Fsubspawn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2Fsubspawn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigwardman%2Fsubspawn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigwardman","download_url":"https://codeload.github.com/craigwardman/subspawn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244031033,"owners_count":20386534,"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":["child-process","node","process"],"created_at":"2024-10-10T18:11:41.688Z","updated_at":"2025-03-19T23:30:55.726Z","avatar_url":"https://github.com/craigwardman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# subspawn\nAn npm library for spawning (and killing) synchronous and asynchronous sub processes from node.\n\nThis package is a wrapper around Node's `child_process` library, which offers the ability to create child processes but isn't as easy\nto get working as you might hope. \n\nThe idea behind this code is to provide:\n\n1) A cross platform way of creating child processes that will share the stdout of the parent (including 'npm' scripts)\n2) Synchronous and asynchronous methods of running the sub processes\n3) A cross plaform way of killing the child processes, including any descendants of those child processes\n\nThe original use-case for this module was for use in a complex npm build script, whereby writing the build sequence as TypeScript made\nmore sense than daisy chaining lots of \"npm\" commands together. You can read more about this too on my blog: http://www.craigwardman.com/Blogging/BlogEntry/writing-an-npm-startup-script-in-typescript-to-support-complex-scenarios\n\n# usage\nInstall the package into your application of choice the usual way (`npm i subspawn`)\n\nImport the module into your JavaScript or TypeScript node file (`import { subProcess, subProcessSync } from 'subspawn'`)\n\n\u0026nbsp;\n\nUse the appropriate function to run a child process, \n```\nsubProcessSync(\u003ccommand\u003e, \u003cshowOutput\u003e)\nsubProcess(\u003cowner\u003e, \u003ccommand\u003e, \u003cshowOutput\u003e)\n```\n\ne.g.\n\nSynchronous:\n`subProcessSync('npm run tsc', true)`\n\nThis will block execution until the command completes, so no \"child process\" needs to be cleaned up at the end.\n\nAsynchronous:\n`subProcess('build', 'npm run start-bg-service', true)`\n\nThis will not block execution, and the \"child process\" will be killed when the parent process exits (or earlier if you call `killSubProcesses('build')`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigwardman%2Fsubspawn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigwardman%2Fsubspawn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigwardman%2Fsubspawn/lists"}