Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c447ba04
Kaydet (Commit)
c447ba04
authored
Ock 06, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23140, asyncio: Fix cancellation of Process.wait(). Check the state of
the waiter future before setting its result.
üst
8c1a4a23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
subprocess.py
Lib/asyncio/subprocess.py
+2
-1
test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+28
-0
No files found.
Lib/asyncio/subprocess.py
Dosyayı görüntüle @
c447ba04
...
@@ -96,7 +96,8 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
...
@@ -96,7 +96,8 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
returncode
=
self
.
_transport
.
get_returncode
()
returncode
=
self
.
_transport
.
get_returncode
()
while
self
.
_waiters
:
while
self
.
_waiters
:
waiter
=
self
.
_waiters
.
popleft
()
waiter
=
self
.
_waiters
.
popleft
()
waiter
.
set_result
(
returncode
)
if
not
waiter
.
cancelled
():
waiter
.
set_result
(
returncode
)
class
Process
:
class
Process
:
...
...
Lib/test/test_asyncio/test_subprocess.py
Dosyayı görüntüle @
c447ba04
...
@@ -223,6 +223,34 @@ class SubprocessMixin:
...
@@ -223,6 +223,34 @@ class SubprocessMixin:
self
.
assertEqual
(
output
.
rstrip
(),
b
'3'
)
self
.
assertEqual
(
output
.
rstrip
(),
b
'3'
)
self
.
assertEqual
(
exitcode
,
0
)
self
.
assertEqual
(
exitcode
,
0
)
def
test_cancel_process_wait
(
self
):
# Issue #23140: cancel Process.wait()
@asyncio.coroutine
def
wait_proc
(
proc
,
event
):
event
.
set
()
yield
from
proc
.
wait
()
@asyncio.coroutine
def
cancel_wait
():
proc
=
yield
from
asyncio
.
create_subprocess_exec
(
*
PROGRAM_BLOCKED
,
loop
=
self
.
loop
)
# Create an internal future waiting on the process exit
event
=
asyncio
.
Event
(
loop
=
self
.
loop
)
task
=
self
.
loop
.
create_task
(
wait_proc
(
proc
,
event
))
yield
from
event
.
wait
()
# Cancel the future
task
.
cancel
()
# Kill the process and wait until it is done
proc
.
kill
()
yield
from
proc
.
wait
()
self
.
loop
.
run_until_complete
(
cancel_wait
())
if
sys
.
platform
!=
'win32'
:
if
sys
.
platform
!=
'win32'
:
# Unix
# Unix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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