Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
c9bc2f44
Commit
c9bc2f44
authored
Aug 30, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove os.dup2 calls altogether
parent
86497e98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
packages/pytest/meta.yaml
packages/pytest/meta.yaml
+1
-1
packages/pytest/patches/named-tmp-and-rm-dup2.patch
packages/pytest/patches/named-tmp-and-rm-dup2.patch
+12
-8
No files found.
packages/pytest/meta.yaml
View file @
c9bc2f44
...
...
@@ -7,7 +7,7 @@ source:
md5
:
8ca6124a3a80f9555c50f5c09056ea02
patches
:
-
patches/
use-named-temporary-file
.patch
-
patches/
named-tmp-and-rm-dup2
.patch
requirements
:
run
:
...
...
packages/pytest/patches/
use-named-temporary-file
.patch
→
packages/pytest/patches/
named-tmp-and-rm-dup2
.patch
View file @
c9bc2f44
diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py
index faa767a8..5
51484b0
100644
index faa767a8..5
18f5c8b
100644
--- a/src/_pytest/capture.py
+++ b/src/_pytest/capture.py
@@ -10,7 +10,7 @@
import sys
...
...
@@ -11,34 +11,38 @@ index faa767a8..551484b0 100644
import six
import pytest
@@ -482,7 +482,7 @@
class FDCaptureBinary(object):
@@ -471,7 +471,6 @@
class FDCaptureBinary(object):
else:
self.syscapture = NoCapture()
self.tmpfile = tmpfile
- self.tmpfile_fd = tmpfile.fileno()
def __repr__(self):
return "<FDCapture %s oldfd=%s>" % (self.targetfd, self.targetfd_save)
@@ -482,7 +481,6 @@
class FDCaptureBinary(object):
os.fstat(self.targetfd_save)
except (AttributeError, OSError):
raise ValueError("saved filedescriptor not valid anymore")
- os.dup2(self.tmpfile_fd, self.targetfd)
+ self.tmpfile_fd = os.dup(self.targetfd)
self.syscapture.start()
def snap(self):
@@ -496,18 +49
6,18
@@
class FDCaptureBinary(object):
@@ -496,18 +49
4,14
@@
class FDCaptureBinary(object):
""" stop capturing, restore streams, return original capture file,
seeked to position zero. """
targetfd_save = self.__dict__.pop("targetfd_save")
- os.dup2(targetfd_save, self.targetfd)
+ targetfd_save = os.dup(self.targetfd)
os.close(targetfd_save)
- os.close(targetfd_save)
self.syscapture.done()
_attempt_to_close_capture_file(self.tmpfile)
def suspend(self):
self.syscapture.suspend()
- os.dup2(self.targetfd_save, self.targetfd)
+ self.targetfd_save = os.dup(self.targetfd)
def resume(self):
self.syscapture.resume()
- os.dup2(self.tmpfile_fd, self.targetfd)
+ self.tmpfile_fd = os.dup(self.targetfd)
def writeorg(self, data):
""" write to original file descriptor. """
...
...
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