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
bb839ef8
Kaydet (Commit)
bb839ef8
authored
Agu 27, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More str/bytes goodness.
üst
f6db4099
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
subprocess.py
Lib/subprocess.py
+2
-2
test_subprocess.py
Lib/test/test_subprocess.py
+8
-7
No files found.
Lib/subprocess.py
Dosyayı görüntüle @
bb839ef8
...
...
@@ -553,8 +553,8 @@ class Popen(object):
def
_translate_newlines
(
self
,
data
):
data
=
data
.
replace
(
"
\r\n
"
,
"
\n
"
)
data
=
data
.
replace
(
"
\r
"
,
"
\n
"
)
data
=
data
.
replace
(
b
"
\r\n
"
,
b
"
\n
"
)
data
=
data
.
replace
(
b
"
\r
"
,
b
"
\n
"
)
return
str
(
data
)
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
bb839ef8
...
...
@@ -118,7 +118,7 @@ class ProcessTestCase(unittest.TestCase):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import sys; sys.exit(sys.stdin.read() == "pear")'
],
stdin
=
subprocess
.
PIPE
)
p
.
stdin
.
write
(
"pear"
)
p
.
stdin
.
write
(
b
"pear"
)
p
.
stdin
.
close
()
p
.
wait
()
self
.
assertEqual
(
p
.
returncode
,
1
)
...
...
@@ -138,7 +138,7 @@ class ProcessTestCase(unittest.TestCase):
def
test_stdin_fileobj
(
self
):
# stdin is set to open file object
tf
=
tempfile
.
TemporaryFile
()
tf
.
write
(
"pear"
)
tf
.
write
(
b
"pear"
)
tf
.
seek
(
0
)
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import sys; sys.exit(sys.stdin.read() == "pear")'
],
...
...
@@ -254,7 +254,8 @@ class ProcessTestCase(unittest.TestCase):
stdout
=
subprocess
.
PIPE
,
cwd
=
tmpdir
)
normcase
=
os
.
path
.
normcase
self
.
assertEqual
(
normcase
(
p
.
stdout
.
read
()),
bytes
(
normcase
(
tmpdir
)))
self
.
assertEqual
(
normcase
(
p
.
stdout
.
read
()
.
decode
(
"utf-8"
)),
normcase
(
tmpdir
))
def
test_env
(
self
):
newenv
=
os
.
environ
.
copy
()
...
...
@@ -270,7 +271,7 @@ class ProcessTestCase(unittest.TestCase):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import sys; sys.exit(sys.stdin.read() == "pear")'
],
stdin
=
subprocess
.
PIPE
)
p
.
communicate
(
"pear"
)
p
.
communicate
(
b
"pear"
)
self
.
assertEqual
(
p
.
returncode
,
1
)
def
test_communicate_stdout
(
self
):
...
...
@@ -289,7 +290,7 @@ class ProcessTestCase(unittest.TestCase):
self
.
assertEqual
(
stdout
,
None
)
# When running with a pydebug build, the # of references is outputted
# to stderr, so just check if stderr at least started with "pinapple"
self
.
assert_
(
stderr
.
startswith
(
"pineapple"
))
self
.
assert_
(
stderr
.
startswith
(
b
"pineapple"
))
def
test_communicate
(
self
):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
...
...
@@ -343,8 +344,8 @@ class ProcessTestCase(unittest.TestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
p
.
stdin
.
write
(
"banana"
)
(
stdout
,
stderr
)
=
p
.
communicate
(
"split"
)
p
.
stdin
.
write
(
b
"banana"
)
(
stdout
,
stderr
)
=
p
.
communicate
(
b
"split"
)
self
.
assertEqual
(
stdout
,
b
"bananasplit"
)
self
.
assertEqual
(
remove_stderr_debug_decorations
(
stderr
),
""
)
...
...
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