Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
f442fdbd
Commit
f442fdbd
authored
Oct 10, 2018
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
20d6fe4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
slapos/grid/utils.py
slapos/grid/utils.py
+2
-2
slapos/tests/grid_utils.py
slapos/tests/grid_utils.py
+3
-3
No files found.
slapos/grid/utils.py
View file @
f442fdbd
...
...
@@ -116,7 +116,7 @@ class SlapPopen(subprocess.Popen):
# don't leak log & co. filedescriptors to child process
kwargs
.
setdefault
(
'close_fds'
,
True
)
subprocess
.
Popen
.
__init__
(
self
,
*
args
,
**
kwargs
)
subprocess
.
Popen
.
__init__
(
self
,
universal_newlines
=
True
,
*
args
,
**
kwargs
)
if
debug
:
self
.
wait
()
self
.
output
=
'(output not captured in debug mode)'
...
...
@@ -133,7 +133,7 @@ class SlapPopen(subprocess.Popen):
break
if
line
:
output_lines
.
append
(
line
)
logger
.
info
(
line
.
rstrip
(
b
'
\
n
'
))
logger
.
info
(
line
.
rstrip
(
'
\
n
'
))
self
.
output
=
''
.
join
(
output_lines
)
...
...
slapos/tests/grid_utils.py
View file @
f442fdbd
...
...
@@ -65,7 +65,7 @@ class SlapPopenTestCase(unittest.TestCase):
def
test_debug
(
self
):
"""Test debug=True, which keeps interactive.
"""
self
.
script
.
write
(
'#!/bin/sh
\
n
echo "exit code?"
\
n
read rc
\
n
exit $rc'
)
self
.
script
.
write
(
b
'#!/bin/sh
\
n
echo "exit code?"
\
n
read rc
\
n
exit $rc'
)
self
.
script
.
close
()
# keep a reference to stdin and stdout to restore them later
...
...
@@ -74,7 +74,7 @@ class SlapPopenTestCase(unittest.TestCase):
# replace stdin with a pipe that will write 123
child_stdin_r
,
child_stdin_w
=
os
.
pipe
()
os
.
write
(
child_stdin_w
,
"123"
)
os
.
write
(
child_stdin_w
,
b
"123"
)
os
.
close
(
child_stdin_w
)
os
.
dup2
(
child_stdin_r
,
sys
.
stdin
.
fileno
())
...
...
@@ -88,7 +88,7 @@ class SlapPopenTestCase(unittest.TestCase):
debug
=
True
,
logger
=
logging
.
getLogger
())
# program output
self
.
assertEqual
(
'exit code?
\
n
'
,
os
.
read
(
child_stdout_r
,
1024
))
self
.
assertEqual
(
b
'exit code?
\
n
'
,
os
.
read
(
child_stdout_r
,
1024
))
self
.
assertEqual
(
123
,
program
.
returncode
)
self
.
assertEqual
(
'(output not captured in debug mode)'
,
program
.
output
)
...
...
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