Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
5614ce16
Commit
5614ce16
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Improve test for bytes-vs-str output streams
parent
58b22bfb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/run.py
+8
-3
8 additions, 3 deletions
fsl/utils/run.py
with
8 additions
and
3 deletions
fsl/utils/run.py
+
8
−
3
View file @
5614ce16
...
...
@@ -127,11 +127,16 @@ def run(*args, **kwargs):
# the process stdout/err on separate threads
# to avoid deadlocks.
def
forward
(
in_
,
*
outs
):
# not all file-likes have a mode attribute -
# if not present, assume a string stream
omodes
=
[
getattr
(
o
,
'
mode
'
,
'
w
'
)
for
o
in
outs
]
def
realForward
():
for
line
in
in_
:
for
o
in
outs
:
if
'
b
'
in
o
.
mode
:
o
.
write
(
line
)
else
:
o
.
write
(
line
.
decode
(
'
utf-8
'
))
for
i
,
o
in
enumerate
(
outs
)
:
if
'
b
'
in
omode
s
[
i
]
:
o
.
write
(
line
)
else
:
o
.
write
(
line
.
decode
(
'
utf-8
'
))
t
=
threading
.
Thread
(
target
=
realForward
)
t
.
daemon
=
True
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment