mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
Fix output_grabber.py to allow several calls
This commit is contained in:
parent
bd3e8db852
commit
9d66c11ac4
2 changed files with 4 additions and 4 deletions
|
@ -17,8 +17,6 @@ class OutputGrabber(object):
|
||||||
self.origstream = sys.stdout
|
self.origstream = sys.stdout
|
||||||
self.origstreamfd = self.origstream.fileno()
|
self.origstreamfd = self.origstream.fileno()
|
||||||
self.capturedtext = ""
|
self.capturedtext = ""
|
||||||
# Create a pipe so the stream can be captured:
|
|
||||||
self.pipe_out, self.pipe_in = os.pipe()
|
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.start()
|
self.start()
|
||||||
|
@ -32,6 +30,8 @@ class OutputGrabber(object):
|
||||||
Start capturing the stream data.
|
Start capturing the stream data.
|
||||||
"""
|
"""
|
||||||
self.capturedtext = ""
|
self.capturedtext = ""
|
||||||
|
# Create a pipe so the stream can be captured:
|
||||||
|
self.pipe_out, self.pipe_in = os.pipe()
|
||||||
# Save a copy of the stream:
|
# Save a copy of the stream:
|
||||||
self.streamfd = os.dup(self.origstreamfd)
|
self.streamfd = os.dup(self.origstreamfd)
|
||||||
# Replace the original stream with our write pipe:
|
# Replace the original stream with our write pipe:
|
||||||
|
|
|
@ -17,8 +17,6 @@ class OutputGrabber(object):
|
||||||
self.origstream = sys.stdout
|
self.origstream = sys.stdout
|
||||||
self.origstreamfd = self.origstream.fileno()
|
self.origstreamfd = self.origstream.fileno()
|
||||||
self.capturedtext = ""
|
self.capturedtext = ""
|
||||||
# Create a pipe so the stream can be captured:
|
|
||||||
self.pipe_out, self.pipe_in = os.pipe()
|
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.start()
|
self.start()
|
||||||
|
@ -32,6 +30,8 @@ class OutputGrabber(object):
|
||||||
Start capturing the stream data.
|
Start capturing the stream data.
|
||||||
"""
|
"""
|
||||||
self.capturedtext = ""
|
self.capturedtext = ""
|
||||||
|
# Create a pipe so the stream can be captured:
|
||||||
|
self.pipe_out, self.pipe_in = os.pipe()
|
||||||
# Save a copy of the stream:
|
# Save a copy of the stream:
|
||||||
self.streamfd = os.dup(self.origstreamfd)
|
self.streamfd = os.dup(self.origstreamfd)
|
||||||
# Replace the original stream with our write pipe:
|
# Replace the original stream with our write pipe:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue