{ "info": { "author": "Michael Komitee", "author_email": "mkomitee@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Status-code helper utilities\n============================\n\npstatus is can be used to extract meaning from process status codes as returned\nby ``os.system``, ``os.wait``, ``os.waitpid``, as well as ``subprocess.call``,\n``subprocess.CalledProcessError.returncode``, ``subprocess.Popen.call``,\n``subprocess.Popen.wait``, and ``subprocess.Popen.returncode``.\n\nIt exports a function ``split`` which extracts an exit code, a signal number, a\nflag indicating whether or not the process left a core dump behind.\n\nAlso includes a module ``pstatus.os`` which exports ``system``, ``wait``,\n``wait3``, ``wait4``, and ``waitpid``. Each of these shadow the functions with\nthe same name in the standard library's ``os`` module, but instead of returning\na status code, returns a split tuple.\n\n``API`` documentation is available at ReadTheDocs_.\n\n\npstatus\n-------\n\npstatus.split\n~~~~~~~~~~~~~\n\nWith ``os.system``:\n\n>>> split(os.system('true'))\nStatus(exit=0, signal=None, core=False)\n>>> split(os.system('false'))\nStatus(exit=1, signal=None, core=False)\n\nUsing ``os.spawnlp`` and ``os.kill`` to demonstrate extraction of signals:\n\n>>> pid = os.spawnlp(os.P_NOWAIT, 'sleep', 'sleep', '100')\n>>> os.kill(pid, 15)\n>>> _, code = os.waitpid(pid, 0)\n>>> split(code)\nStatus(exit=None, signal=15, core=False)\n\nWith ``subprocess.call``:\n\n>>> import subprocess\n>>> split(subprocess.call(['true']), subprocess=True)\nStatus(exit=0, signal=None, core=None)\n>>> split(subprocess.call(['false']), subprocess=True)\nStatus(exit=1, signal=None, core=None)\n\nUsing ``subprocess.Popen`` and ``subprocess.Popen.kill`` to extract\nsignals:\n\n>>> p = subprocess.Popen(['sleep', '100'])\n>>> p.terminate()\n>>> split(p.wait(), subprocess=True)\nStatus(exit=None, signal=15, core=None)\n\n\npstatus.os\n----------\n\npstatus.os.system\n~~~~~~~~~~~~~~~~~\n\nShadows ``os.system`` and returns split status information.\n\n>>> system('true')\nStatus(exit=0, signal=None, core=False)\n\npstatus.os.wait\n~~~~~~~~~~~~~~~\n\nShadows ``os.wait`` and returns split status information with a pid.\n\n>>> pid = os.spawnlp(os.P_NOWAIT, 'true', 'true')\n>>> wait()\nStatus(pid=12345, exit=0, signal=None, core=False)\n\npstatus.os.wait3\n~~~~~~~~~~~~~~~~\n\nShadows ``os.wait3`` and returns split status information with a pid and rusage.\n\n>>> pid = os.spawnlp(os.P_NOWAIT, 'true', 'true')\n>>> wait3(0)\nStatus(pid=12345, exit=0, signal=None, core=False, rusage=resource.struct_rusage(ru_utime=0.0017259999999999999, ru_stime=0.0018889999999999998, ru_maxrss=499712, ru_ixrss=0, ru_idrss=0, ru_isrss=0, ru_minflt=495, ru_majflt=0, ru_nswap=0, ru_inblock=0, ru_oublock=0, ru_msgsnd=0, ru_msgrcv=0, ru_nsignals=0, ru_nvcsw=0, ru_nivcsw=2))\n\npstatus.os.wait4\n~~~~~~~~~~~~~~~~\n\nShadows ``os.wait4`` and returns split status information with a pid and rusage.\n\n>>> pid = os.spawnlp(os.P_NOWAIT, 'true', 'true')\n>>> wait4(pid, 0)\nStatus(pid=12345, exit=0, signal=None, core=False, rusage=resource.struct_rusage(ru_utime=0.0017259999999999999, ru_stime=0.0018889999999999998, ru_maxrss=499712, ru_ixrss=0, ru_idrss=0, ru_isrss=0, ru_minflt=495, ru_majflt=0, ru_nswap=0, ru_inblock=0, ru_oublock=0, ru_msgsnd=0, ru_msgrcv=0, ru_nsignals=0, ru_nvcsw=0, ru_nivcsw=2))\n\npstatus.os.waitpid\n~~~~~~~~~~~~~~~~~~\n\nShadows ``os.waitpid`` and returns split status information with a pid.\n\n>>> pid = os.spawnlp(os.P_NOWAIT, 'true', 'true')\n>>> waitpid(pid, 0)\nStatus(pid=12345, exit=0, signal=None, core=False)\n\n\n.. _ReadTheDocs: https://pstatus.readthedocs.org/en/latest/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mkomitee/pstatus", "keywords": null, "license": "Copyright (c) 2013, Michael Komitee\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": null, "maintainer_email": null, "name": "pstatus", "package_url": "https://pypi.org/project/pstatus/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pstatus/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mkomitee/pstatus" }, "release_url": "https://pypi.org/project/pstatus/1.1.2/", "requires_dist": null, "requires_python": null, "summary": "Process Status Code Helper", "version": "1.1.2" }, "last_serial": 796766, "releases": { "1.1.2": [ { "comment_text": "", "digests": { "md5": "d7da433f47416d1c2282fc0cc2d1c287", "sha256": "b9f9ac66121cc108532410302978c4ac9607f07e8e60af63aa38cc51ffa93cae" }, "downloads": -1, "filename": "pstatus-1.1.2.tar.gz", "has_sig": false, "md5_digest": "d7da433f47416d1c2282fc0cc2d1c287", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5178, "upload_time": "2013-04-15T02:55:30", "url": "https://files.pythonhosted.org/packages/4a/63/021bb8277aca3bef4b843de41bdd1c598946656cf2c56e9af69d6a9dfa5d/pstatus-1.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d7da433f47416d1c2282fc0cc2d1c287", "sha256": "b9f9ac66121cc108532410302978c4ac9607f07e8e60af63aa38cc51ffa93cae" }, "downloads": -1, "filename": "pstatus-1.1.2.tar.gz", "has_sig": false, "md5_digest": "d7da433f47416d1c2282fc0cc2d1c287", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5178, "upload_time": "2013-04-15T02:55:30", "url": "https://files.pythonhosted.org/packages/4a/63/021bb8277aca3bef4b843de41bdd1c598946656cf2c56e9af69d6a9dfa5d/pstatus-1.1.2.tar.gz" } ] }