File tree 1 file changed +16
-7
lines changed
1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python3
1
+ #!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
4
4
"""
@@ -69,17 +69,20 @@ def test_writable(dirs):
69
69
70
70
71
71
def run_cmd (cmd ):
72
- proc = subprocess .run (cmd , shell = True , stdout = subprocess .PIPE )
73
- ret = proc .returncode
72
+ p = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
73
+ (output , err ) = p .communicate ()
74
+ ## Wait for end of command. Get return returncode ##
75
+ ret = p .wait ()
74
76
if ret :
75
77
log_err ("failed: ret={} cmd={}" .format (ret , cmd ))
76
78
else :
77
79
log_info ("ret={} cmd: {}" .format (ret , cmd ))
78
80
79
- if proc .stdout :
80
- log_info ("stdout: {}" .format (proc .stdout .decode ("utf-8" )))
81
- if proc .stderr :
82
- log_info ("stderr: {}" .format (proc .stderr .decode ("utf-8" )))
81
+ if output :
82
+ log_info ("stdout: {}" .format (output .decode ("utf-8" )))
83
+ if err :
84
+ log_info ("stderr: {}" .format (err .decode ("utf-8" )))
85
+
83
86
return ret
84
87
85
88
@@ -113,6 +116,12 @@ def do_mnt(dirs):
113
116
break
114
117
115
118
if ret :
119
+ for i in (UPPER_DIR , WORK_DIR ):
120
+ if os .path .exists (i ):
121
+ ret = run_cmd ("rm -rf {}" .format (i ))
122
+ if ret :
123
+ log_err ("Failed to remove {}" .format (i ))
124
+
116
125
log_err ("Failed to mount {} as Read-Write" .format (dirs ))
117
126
else :
118
127
log_info ("{} are mounted as Read-Write" .format (dirs ))
You can’t perform that action at this time.
0 commit comments