# ⛏️sproc: subprocesseses for subhumanses ⛏
Run a command in a subprocess and yield lines of text from `stdout` and
`stderr` independently.
Useful for handling long-running proceesses that write to both `stdout` and
`stderr`.
### Simple Example
import sproc
CMD = 'my-unix-command "My Cool File.txt" No-file.txt'
for ok, line in sproc.Sub(CMD) as sp:
if ok:
print(' ', line)
else:
print('!', line)
if sp.returncode:
print('Error code', sp.returncode)
# Return two lists of text lines and a returncode
out_lines, err_lines, returncode = sproc.run(CMD)
# Call callback functions with lines of text read from stdout and stderr
returncode = sproc.call(CMD, save_results, print_errors)
# Log stdout and stderr, with prefixes
returncode = sproc.log(CMD)
### [API Documentation](https://rec.github.io/sproc#sproc--api-documentation)
Raw data
{
"_id": null,
"home_page": "https://github.com/rec/sproc",
"name": "sproc",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Tom Ritchford",
"author_email": "tom@swirly.com",
"download_url": "https://files.pythonhosted.org/packages/5e/90/99b4aa68228420860e173d3ef3a9cb18fd0fcfefb2d7a10cee1fa5825a49/sproc-2.4.1.tar.gz",
"platform": null,
"description": "# \u26cf\ufe0fsproc: subprocesseses for subhumanses \u26cf\n\nRun a command in a subprocess and yield lines of text from `stdout` and\n`stderr` independently.\n\nUseful for handling long-running proceesses that write to both `stdout` and\n`stderr`.\n\n### Simple Example\n\n import sproc\n\n CMD = 'my-unix-command \"My Cool File.txt\" No-file.txt'\n\n for ok, line in sproc.Sub(CMD) as sp:\n if ok:\n print(' ', line)\n else:\n print('!', line)\n\n if sp.returncode:\n print('Error code', sp.returncode)\n\n # Return two lists of text lines and a returncode\n out_lines, err_lines, returncode = sproc.run(CMD)\n\n # Call callback functions with lines of text read from stdout and stderr\n returncode = sproc.call(CMD, save_results, print_errors)\n\n # Log stdout and stderr, with prefixes\n returncode = sproc.log(CMD)\n\n\n### [API Documentation](https://rec.github.io/sproc#sproc--api-documentation)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u26cf Subprocesseses for subhumanses \u26cf",
"version": "2.4.1",
"project_urls": {
"Documentation": "https://rec.github.io/sproc",
"Homepage": "https://github.com/rec/sproc",
"Repository": "https://github.com/rec/sproc"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2e813e85035016138e6ee0892f561a5b4f86a2cfaf3ba89c8efc0326151cb267",
"md5": "988c92c72caedb94a95288641a0f2cb7",
"sha256": "bced068f51ee206c9962a09d0d789d57330ed80bbc032f17c7aae8e1cfdb7e29"
},
"downloads": -1,
"filename": "sproc-2.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "988c92c72caedb94a95288641a0f2cb7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5056,
"upload_time": "2024-01-25T11:24:06",
"upload_time_iso_8601": "2024-01-25T11:24:06.471467Z",
"url": "https://files.pythonhosted.org/packages/2e/81/3e85035016138e6ee0892f561a5b4f86a2cfaf3ba89c8efc0326151cb267/sproc-2.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5e9099b4aa68228420860e173d3ef3a9cb18fd0fcfefb2d7a10cee1fa5825a49",
"md5": "773c02a62a6237098766a0a9fdc719d5",
"sha256": "9753942c284fc1927623f58e3ecf1b0286c854d09e6f331f490e5bb309058ad0"
},
"downloads": -1,
"filename": "sproc-2.4.1.tar.gz",
"has_sig": false,
"md5_digest": "773c02a62a6237098766a0a9fdc719d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4387,
"upload_time": "2024-01-25T11:24:07",
"upload_time_iso_8601": "2024-01-25T11:24:07.618890Z",
"url": "https://files.pythonhosted.org/packages/5e/90/99b4aa68228420860e173d3ef3a9cb18fd0fcfefb2d7a10cee1fa5825a49/sproc-2.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-25 11:24:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rec",
"github_project": "sproc",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "sproc"
}