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
3d8580f6
Kaydet (Commit)
3d8580f6
authored
Eyl 20, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Try a more robust implementation of _kill_process
üst
84e751a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
test_subprocess.py
Lib/test/test_subprocess.py
+14
-20
No files found.
Lib/test/test_subprocess.py
Dosyayı görüntüle @
3d8580f6
...
@@ -826,26 +826,20 @@ class POSIXProcessTestCase(BaseTestCase):
...
@@ -826,26 +826,20 @@ class POSIXProcessTestCase(BaseTestCase):
def
_kill_process
(
self
,
method
,
*
args
):
def
_kill_process
(
self
,
method
,
*
args
):
# Do not inherit file handles from the parent.
# Do not inherit file handles from the parent.
# It should fix failures on some platforms.
# It should fix failures on some platforms.
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
"input()"
],
close_fds
=
True
,
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
"""if 1:
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
import sys, time
sys.stdout.write('x
\\
n')
# Let the process initialize (Issue #3137)
sys.stdout.flush()
time
.
sleep
(
0.4
)
time.sleep(30)
# The process should not terminate prematurely
"""
],
self
.
assertIsNone
(
p
.
poll
())
close_fds
=
True
,
# Retry if the process do not receive the signal.
stdin
=
subprocess
.
PIPE
,
count
,
maxcount
=
0
,
10
stdout
=
subprocess
.
PIPE
,
while
count
<
maxcount
and
p
.
poll
()
is
None
:
stderr
=
subprocess
.
PIPE
)
getattr
(
p
,
method
)(
*
args
)
# Wait for the interpreter to be completely initialized before
time
.
sleep
(
0.1
)
# sending any signal.
count
+=
1
p
.
stdout
.
read
(
1
)
getattr
(
p
,
method
)(
*
args
)
if
count
==
maxcount
:
self
.
skipTest
(
"apparently failed to send the signal"
)
self
.
assertIsNotNone
(
p
.
poll
(),
"the subprocess did not terminate"
)
if
count
>
1
:
print
(
"p.{}{} succeeded after "
"{} attempts"
.
format
(
method
,
args
,
count
),
file
=
sys
.
stderr
)
return
p
return
p
def
test_send_signal
(
self
):
def
test_send_signal
(
self
):
...
...
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