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
81a191b3
Kaydet (Commit)
81a191b3
authored
May 26, 2007
tarafından
Peter Astrand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Applied patch 1669481, slightly modified: Support close_fds on Win32
üst
5f9b6c9a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
libsubprocess.tex
Doc/lib/libsubprocess.tex
+4
-1
subprocess.py
Lib/subprocess.py
+4
-5
test_subprocess.py
Lib/test/test_subprocess.py
+8
-0
No files found.
Doc/lib/libsubprocess.tex
Dosyayı görüntüle @
81a191b3
...
...
@@ -89,7 +89,10 @@ called in the child process just before the child is executed.
If
\var
{
close
_
fds
}
is true, all file descriptors except
\constant
{
0
}
,
\constant
{
1
}
and
\constant
{
2
}
will be closed before the child process is
executed. (
\UNIX
{}
only)
executed. (
\UNIX
{}
only). Or, on Windows, if
\var
{
close
_
fds
}
is true
then no handles will be inherited by the child process. Note that on
Windows, you cannot set
\var
{
close
_
fds
}
to true and also redirect the
standard handles by setting
\var
{
stdin
}
,
\var
{
stdout
}
or
\var
{
stderr
}
.
If
\var
{
shell
}
is
\constant
{
True
}
, the specified command will be
executed through the shell.
...
...
Lib/subprocess.py
Dosyayı görüntüle @
81a191b3
...
...
@@ -545,9 +545,10 @@ class Popen(object):
if
preexec_fn
is
not
None
:
raise
ValueError
(
"preexec_fn is not supported on Windows "
"platforms"
)
if
close_fds
:
if
close_fds
and
(
stdin
is
not
None
or
stdout
is
not
None
or
stderr
is
not
None
):
raise
ValueError
(
"close_fds is not supported on Windows "
"platforms"
)
"platforms
if you redirect stdin/stdout/stderr
"
)
else
:
# POSIX
if
startupinfo
is
not
None
:
...
...
@@ -804,9 +805,7 @@ class Popen(object):
hp
,
ht
,
pid
,
tid
=
CreateProcess
(
executable
,
args
,
# no special security
None
,
None
,
# must inherit handles to pass std
# handles
1
,
int
(
not
close_fds
),
creationflags
,
env
,
cwd
,
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
81a191b3
...
...
@@ -617,8 +617,16 @@ class ProcessTestCase(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
subprocess
.
call
,
[
sys
.
executable
,
"-c"
,
"import sys; sys.exit(47)"
],
stdout
=
subprocess
.
PIPE
,
close_fds
=
True
)
def
test_close_fds
(
self
):
# close file descriptors
rc
=
subprocess
.
call
([
sys
.
executable
,
"-c"
,
"import sys; sys.exit(47)"
],
close_fds
=
True
)
self
.
assertEqual
(
rc
,
47
)
def
test_shell_sequence
(
self
):
# Run command through the shell (sequence)
newenv
=
os
.
environ
.
copy
()
...
...
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