{"id":15435208,"url":"https://github.com/drptbl/listen-spawn","last_synced_at":"2026-06-08T19:02:11.189Z","repository":{"id":88033468,"uuid":"47044957","full_name":"drptbl/listen-spawn","owner":"drptbl","description":null,"archived":false,"fork":false,"pushed_at":"2015-11-29T00:52:54.000Z","size":200,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-21T14:42:09.291Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/drptbl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-29T00:52:50.000Z","updated_at":"2019-07-08T18:49:27.000Z","dependencies_parsed_at":"2023-03-10T13:13:04.093Z","dependency_job_id":null,"html_url":"https://github.com/drptbl/listen-spawn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/drptbl/listen-spawn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Flisten-spawn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Flisten-spawn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Flisten-spawn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Flisten-spawn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drptbl","download_url":"https://codeload.github.com/drptbl/listen-spawn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Flisten-spawn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34075986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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-01T18:43:05.653Z","updated_at":"2026-06-08T19:02:11.173Z","avatar_url":"https://github.com/drptbl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# listen-spawn [![Build status](https://travis-ci.org/twolfson/listen-spawn.png?branch=master)](https://travis-ci.org/twolfson/listen-spawn)\n\nStart a HTTP server which runs commands when pinged.\n\nThis is **intended for development use only**. It is supported and tested on Linux and Windows.\n\nIt was designed to allow for execution of semi-frequent commands (e.g. a blocking command, starting a browser). This is complimented by [text editor specific plugins][plugins] which make requests to the server.\n\nBelow is a screenshot of using [Sublime Text 2][subl] with [sublime-request][request] and a keyboard shortcut to launch [browser-launcher][launcher] tests.\n\n![Sublime Text 2 using sublime-request and browser-launcher][screenshot]\n\n[plugins]: #sublime-text-plugin\n[subl]: http://sublimetext.com/\n[screenshot]: screenshot.png\n[launcher]: https://github.com/substack/browser-launcher\n\n## Getting Started\nInstall the module globally with: `npm install -g listen-spawn`\n\n```sh\n# Navigate to your working directory\ncd my_project\n\n# Set up listen-spawn to run `npm test`\nlisten-spawn -- npm test # Listening at http://localhost:7060/ [...]\n\n# In a separate process, curl the server to run `npm test` again\ncurl http://localhost:7060/ # \u003e my_project@0.1.0 test [...]\n```\n\n### Integrating with Sublime Text 2\n#### sublime-request\n[sublime-request][request] is a [Sublime Text 2][subl] plugin which adds the command `request`. The following shortcut makes a `curl` request to `http://localhost:7060/`.\n\n```js\n// Add the following to your \"Key Bindings - User\" inside the []\n{ \"keys\": [\"alt+x\"], \"command\": \"request\", \"args\": {\"open_args\": [\"http://localhost:7060/\"]} }\n```\n\n[request]: https://github.com/twolfson/sublime-request\n\n#### Out of the box solution\nThe following shortcut invokes a `curl` request to `http://localhost:7060/` when `alt+x` is pressed. The downside is this opens a panel every time it is executed.\n\n```js\n// Add the following to your \"Key Bindings - User\" inside the []\n{ \"keys\": [\"alt+x\"], \"command\": \"exec\", \"args\": {\"cmd\": [\"curl\", \"http://localhost:7060/\"]} }\n```\n\n### File watching based solution\nIf you are looking for a solution which performs an action when a file changes rather than when a server is pinged, then you should checkout [nodemon][].\n\n[nodemon]: https://github.com/remy/nodemon\n\n## Documentation\n`listen-spawn` installs a CLI endpoint via `npm`. It is good practice to always use `--` to separate `options` from `command` as this can lead to unintended parsing.\n\n```sh\n$ listen-spawn\nUsage: listen-spawn [options] -- command [args...]\nStarts server and invokes command with arguments whenever touched.\n\nOptions:\n  --port  Port to start server on  [default: 7060]\n```\n\n### Windows caveats\nIf you are trying to run command prompt specific commands (e.g. `echo`), you will run into trouble. Unfortunately, [`child_process.spawn`][cp-spawn] does not like to run these. To remedy this, you will need to run it via `cmd /c`.\n\n```bat\nE:\\listen-spawn\u003e REM This will fail\nE:\\listen-spawn\u003e listen-spawn -- echo 1\n24 Jul 01:30:41 - [listen-spawn] Listening at http://localhost:7060/\n...\nError: spawn ENOENT\nE:\\listen-spawn\u003e REM To make it run, use `cmd /c`\nE:\\listen-spawn\u003e listen-spawn -- cmd /c echo 1\n24 Jul 01:31:37 - [listen-spawn] Listening at http://localhost:7060/\n24 Jul 01:31:37 - [listen-spawn] Starting new process -- cmd /c echo 1\n1\n24 Jul 01:31:37 - [listen-spawn] App exited cleanly\n```\n\n[cp-spawn]: http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options\n\n## Examples\n### Run a specific test\n```sh\n$ listen-spawn -- mocha test/assert.js\n20 Jun 04:17:58 - [listen-spawn] Listening at http://localhost:7060/\n20 Jun 04:17:58 - [listen-spawn] Starting new process -- mocha test/assert.js\n\n  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․\n\n  42 tests complete (16 ms)\n\n20 Jun 04:17:58 - [listen-spawn] App exited cleanly\n```\n\n### Script testing a browser launcher\n```sh\n$ listen-spawn -- node example/launch.js\n20 Jun 04:20:25 - [listen-spawn] Listening at http://localhost:7060/\n20 Jun 04:20:25 - [listen-spawn] Starting new process -- node example/launch.js\nStarting browser\n[...]\n```\n\n## Donating\nSupport this project and [others by twolfson][gittip] via [gittip][].\n\n[![Support via Gittip][gittip-badge]][gittip]\n\n[gittip-badge]: https://rawgithub.com/twolfson/gittip-badge/master/dist/gittip.png\n[gittip]: https://www.gittip.com/twolfson/\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via [grunt](https://github.com/gruntjs/grunt) and test via `npm test`.\n\n## License\nCopyright (c) 2013 Todd Wolfson\n\nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrptbl%2Flisten-spawn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrptbl%2Flisten-spawn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrptbl%2Flisten-spawn/lists"}