bounded_subprocess 2.1.0__py3-none-any.whl → 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bounded_subprocess might be problematic. Click here for more details.

@@ -33,7 +33,7 @@ async def run(
33
33
  _STDIN_WRITE_TIMEOUT,
34
34
  sleep_interval=SLEEP_BETWEEN_READS,
35
35
  )
36
- state.close_stdin()
36
+ await state.close_stdin_async(_STDIN_WRITE_TIMEOUT)
37
37
 
38
38
  # We sleep for 0.1 seconds in each iteration.
39
39
  max_iterations = timeout_seconds * 10
@@ -9,7 +9,7 @@ import asyncio
9
9
 
10
10
  MAX_BYTES_PER_READ = 1024
11
11
  SLEEP_BETWEEN_READS = 0.1
12
- _STDIN_WRITE_TIMEOUT = 1.0
12
+ _STDIN_WRITE_TIMEOUT = 3
13
13
 
14
14
 
15
15
  class Result:
@@ -147,6 +147,20 @@ class BoundedSubprocessState:
147
147
  except BrokenPipeError:
148
148
  pass
149
149
 
150
+ async def close_stdin_async(self, timeout: int) -> None:
151
+ if self.p.stdin is None:
152
+ return
153
+ for _ in range(timeout):
154
+ try:
155
+ self.p.stdin.close()
156
+ return
157
+ except BlockingIOError:
158
+ await asyncio.sleep(1)
159
+ except BrokenPipeError:
160
+ return
161
+
162
+
163
+
150
164
  def try_read(self) -> bool:
151
165
  """
152
166
  Reads from the process. Returning False indicates that we should stop
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bounded_subprocess
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: A library to facilitate running subprocesses that may misbehave.
5
5
  Project-URL: Homepage, https://github.com/arjunguha/bounded_subprocess
6
6
  Project-URL: Bug Tracker, https://github.com/arjunguha/bounded_subprocess
@@ -0,0 +1,10 @@
1
+ bounded_subprocess/__init__.py,sha256=L88cc8vG7GE11T0fF1-tMUIbRRlOmmlCqa6wopP3Ox8,1003
2
+ bounded_subprocess/bounded_subprocess.py,sha256=-UuVhlbuMEWDNDjr_9tSUkcRxb-3RZKqOqup0nQI0zA,1231
3
+ bounded_subprocess/bounded_subprocess_async.py,sha256=Rp6EMURNL8D5-zyEfPfW93GsResWAykla-W80bjE0eQ,1575
4
+ bounded_subprocess/interactive.py,sha256=4fG4NB3eN5rqssUpfjiEQL2F-S7eDBwB2Mw1gzCL3Qk,4149
5
+ bounded_subprocess/interactive_async.py,sha256=WKPA2XBnq_qMh5WijyoSOpg2iJcsYcQSXNGjv6IEEfA,1979
6
+ bounded_subprocess/util.py,sha256=OLIfD3r_Kf2LZzMU98HGeLHh3TdVgwoAO1GEMpEx4DQ,6760
7
+ bounded_subprocess-2.2.0.dist-info/METADATA,sha256=ELBEH4eszwiufzd5dKRCblGEaebB-qLlhJWoU9gQyrM,2664
8
+ bounded_subprocess-2.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ bounded_subprocess-2.2.0.dist-info/licenses/LICENSE.txt,sha256=UVerBV0_1vMFt8QkaXuVnZVSlOiKDiBSieK5MNLy4Ls,1086
10
+ bounded_subprocess-2.2.0.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- bounded_subprocess/__init__.py,sha256=L88cc8vG7GE11T0fF1-tMUIbRRlOmmlCqa6wopP3Ox8,1003
2
- bounded_subprocess/bounded_subprocess.py,sha256=-UuVhlbuMEWDNDjr_9tSUkcRxb-3RZKqOqup0nQI0zA,1231
3
- bounded_subprocess/bounded_subprocess_async.py,sha256=XSvi-FiKZbVbREnKDGiSG4UVViVoUBCCQzEohAS5GwM,1543
4
- bounded_subprocess/interactive.py,sha256=4fG4NB3eN5rqssUpfjiEQL2F-S7eDBwB2Mw1gzCL3Qk,4149
5
- bounded_subprocess/interactive_async.py,sha256=WKPA2XBnq_qMh5WijyoSOpg2iJcsYcQSXNGjv6IEEfA,1979
6
- bounded_subprocess/util.py,sha256=zaTl2LkhyOelRGotlgISkKy8cURQaTTNweTYoSchISA,6402
7
- bounded_subprocess-2.1.0.dist-info/METADATA,sha256=sxiscwiihS4QqFDVzXhgnwDfPdFBWunmX7N8KScypCw,2664
8
- bounded_subprocess-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- bounded_subprocess-2.1.0.dist-info/licenses/LICENSE.txt,sha256=UVerBV0_1vMFt8QkaXuVnZVSlOiKDiBSieK5MNLy4Ls,1086
10
- bounded_subprocess-2.1.0.dist-info/RECORD,,