@@ -150,7 +150,7 @@ def main():
150
150
os .chdir (export_folder )
151
151
152
152
# this will get changed later:
153
- result = "Interrupted"
153
+ result = None
154
154
155
155
try :
156
156
if args .repo_subfolder :
@@ -161,18 +161,24 @@ def main():
161
161
logging .info ("Using this path to git: %s" , git_path )
162
162
163
163
result = subprocess .run (
164
- [git_path , "fetch" , "origin" ], check = True , capture_output = True
164
+ [git_path , "fetch" , "origin" ],
165
+ check = True ,
166
+ capture_output = True ,
167
+ text = True ,
165
168
)
166
- logging .debug (result )
169
+ logging .debug (result . stdout )
167
170
result = subprocess .run (
168
171
[git_path , "reset" , "--hard" , "origin/main" ],
169
172
check = True ,
170
173
capture_output = True ,
174
+ text = True ,
171
175
)
172
- logging .debug (result )
176
+ logging .debug (result . stdout )
173
177
logging .info ("Now attempting to git pull repo." )
174
- result = subprocess .run ([git_path , "pull" ], check = True , capture_output = True )
175
- logging .debug (result )
178
+ result = subprocess .run (
179
+ [git_path , "pull" ], check = True , capture_output = True , text = True
180
+ )
181
+ logging .debug (result .stdout )
176
182
177
183
# if --delete arg used, delete export folder:
178
184
if args .delete :
@@ -187,25 +193,30 @@ def main():
187
193
[git_path , "add" , "." ],
188
194
check = True ,
189
195
stdout = subprocess .PIPE ,
196
+ text = True ,
190
197
)
191
- logging .debug (result )
198
+ logging .debug (result . stdout )
192
199
result = subprocess .run (
193
200
[git_path , "commit" , "-m" , "add changes from export" ],
194
201
check = True ,
195
- text = True ,
196
202
capture_output = True ,
203
+ text = True ,
197
204
)
198
- logging .debug (result )
205
+ logging .debug (result . stdout )
199
206
result = subprocess .run (
200
207
[git_path , "push" ],
201
208
check = True ,
202
- text = True ,
203
209
capture_output = True ,
210
+ text = True ,
204
211
)
205
- logging .debug (result )
206
- except BaseException as err :
207
- logging .error (err )
208
- logging .debug (result )
212
+ logging .debug (result .stdout )
213
+ except subprocess .CalledProcessError as err :
214
+ logging .error ("Subprocess error: %s" , err )
215
+ logging .debug (result .stdout )
216
+ raise
217
+ except Exception as err :
218
+ logging .error ("An error occurred: %s" , err )
219
+ logging .debug (result .stdout )
209
220
raise
210
221
211
222
logging .info ("----- Session Ended ------" )
0 commit comments