Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
allworldit
python
forkedsubprocess
Commits
4b739384
Commit
4b739384
authored
Sep 26, 2019
by
Nigel Kukard
Browse files
Merge branch 'nkupdates' into 'master'
Nkupdates See merge request
!3
parents
b63bfa00
11cb913a
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
4b739384
...
...
@@ -10,7 +10,7 @@ test_job:
# Create environment
-
pacman -Syu --noconfirm
-
pacman -S --noconfirm grep python
-
pacman -S --noconfirm
python-pythondialog
python-pytest python-pytest-runner python-pytest-cov python-pylint python-isort mypy pylama python-mccabe
python-requests
-
pacman -S --noconfirm python-pytest python-pytest-runner python-pytest-cov python-pylint python-isort mypy pylama python-mccabe
# Run tests
-
python setup.py test
# Artifacts
...
...
src/forkedsubprocess/__init__.py
View file @
4b739384
# Copyright (C) 2019, AllWorldIT.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""Forked subprocesses support for Python."""
import
subprocess
import
threading
from
typing
import
IO
,
Any
,
Callable
,
Dict
,
List
,
Optional
__version__
=
'1.0.
3
'
__version__
=
'1.0.
4
'
# Define our callback types
InputCallback
=
Callable
[[],
str
]
...
...
@@ -271,15 +291,19 @@ class ForkedSubprocess:
raise
ForkedSubprocessNotRunningException
(
'wait() was called on a subprocess which is not running'
)
# Stop writer
self
.
_stdin_writer
.
stop
()
if
self
.
_stdin_writer
:
self
.
_stdin_writer
.
stop
()
# Wait for process exit
self
.
_process
.
wait
()
# Wait for threads to read data and exit
self
.
_stdin_writer
.
wait
()
self
.
_stdout_reader
.
wait
()
self
.
_stderr_reader
.
wait
()
if
self
.
_stdin_writer
:
self
.
_stdin_writer
.
wait
()
if
self
.
_stdout_reader
:
self
.
_stdout_reader
.
wait
()
if
self
.
_stderr_reader
:
self
.
_stderr_reader
.
wait
()
return
self
.
_process
.
returncode
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment