File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,40 @@ async def main(n):
375
375
376
376
self .assertEqual (num_fd_1 , num_fd_2 )
377
377
378
+ def test_subprocess_invalid_stdin (self ):
379
+ fd = None
380
+ for tryfd in range (10000 , 1000 , - 1 ):
381
+ try :
382
+ tryfd = os .dup (tryfd )
383
+ except OSError :
384
+ fd = tryfd
385
+ break
386
+ else :
387
+ os .close (tryfd )
388
+ else :
389
+ self .fail ('could not find a free FD' )
390
+
391
+ async def main ():
392
+ with self .assertRaises (OSError ):
393
+ await asyncio .create_subprocess_exec (
394
+ 'ls' ,
395
+ loop = self .loop ,
396
+ stdin = fd )
397
+
398
+ with self .assertRaises (OSError ):
399
+ await asyncio .create_subprocess_exec (
400
+ 'ls' ,
401
+ loop = self .loop ,
402
+ stdout = fd )
403
+
404
+ with self .assertRaises (OSError ):
405
+ await asyncio .create_subprocess_exec (
406
+ 'ls' ,
407
+ loop = self .loop ,
408
+ stderr = fd )
409
+
410
+ self .loop .run_until_complete (main ())
411
+
378
412
379
413
class _AsyncioTests :
380
414
You can’t perform that action at this time.
0 commit comments