{"id":17708539,"url":"https://github.com/isaaskin/command_spawner","last_synced_at":"2025-03-13T13:32:26.281Z","repository":{"id":62563958,"uuid":"320915721","full_name":"isaaskin/command_spawner","owner":"isaaskin","description":"Command Spawner is a non-blocking command runner library for Python","archived":false,"fork":false,"pushed_at":"2021-03-14T14:12:07.000Z","size":21,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-26T20:06:22.653Z","etag":null,"topics":["callback","command","command-spawner","non-blocking","python","spawn","spawner","subprocess"],"latest_commit_sha":null,"homepage":"","language":"Python","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/isaaskin.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-12-12T20:15:54.000Z","updated_at":"2022-11-21T12:49:56.000Z","dependencies_parsed_at":"2022-11-03T16:00:32.658Z","dependency_job_id":null,"html_url":"https://github.com/isaaskin/command_spawner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaaskin%2Fcommand_spawner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaaskin%2Fcommand_spawner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaaskin%2Fcommand_spawner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaaskin%2Fcommand_spawner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaaskin","download_url":"https://codeload.github.com/isaaskin/command_spawner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243414526,"owners_count":20287137,"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":["callback","command","command-spawner","non-blocking","python","spawn","spawner","subprocess"],"created_at":"2024-10-25T02:07:28.045Z","updated_at":"2025-03-13T13:32:25.949Z","avatar_url":"https://github.com/isaaskin.png","language":"Python","readme":"[![Python package](https://github.com/isaaskin/command_spawner/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/isaaskin/command_spawner/actions/workflows/python-package.yml)\n [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n# Command Spawner  \nCommand Spawner is a non-blocking command runner library for Python.  \n  \nCommand Spawner runs commands at background and provides live output, error and finish data through the provided callback functions.\n\n# Installing\nInstall and update using pip:\n```bash\n$ pip install command-spawner\n```\n\n# Example usage\n```python\n# Triggered when received new stdout\ndef on_output(data):\n    print(f\"Received data: {data}\")\n\n\n# Triggered when received new stderr\ndef on_error(data):\n    print(f\"Received error: {data}\")\n\n\n# Triggered when the command execution has finished\ndef on_finished(data):\n    print(f\"Finished with return code: {data}\")\n\n\n# Triggered when an exception has been thrown from the process module\ndef on_exception(exception):\n    print(f\"Received exception: {exception}\")\n    # or\n    raise exception\n\n\ncommand_spawner = CommandSpawner(command=\"ping google.com\",\n                                 on_output_callback=on_output,  # Suppress output when it is not provided\n                                 on_error_callback=on_error,  # Suppress error when it is not provided\n                                 on_finished_callback=on_finished,  # Suppress return code when it is not provided\n                                 on_exception_callback=on_exception,  # Raise exception on runtime when it is not provided\n                                 shell=False,  # If True, the command will be executed through the shell (not recommended)\n                                 daemon=False  # If True, current runtime will not wait for commands to be executed \n                                 )\n\n# The method to run the process\ncommand_spawner.run()\n\n# The method to kill the current process\ncommand_spawner.kill()\n\n# The method to wait for the process to be finished\ncommand_spawner.wait()\n```\n\nEnjoy!","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaaskin%2Fcommand_spawner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaaskin%2Fcommand_spawner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaaskin%2Fcommand_spawner/lists"}