pywebexec 1.6.12__py3-none-any.whl → 1.6.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pywebexec/pywebexec.py +16 -28
- pywebexec/version.py +2 -2
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/METADATA +1 -1
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/RECORD +8 -8
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/LICENSE +0 -0
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/WHEEL +0 -0
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/entry_points.txt +0 -0
- {pywebexec-1.6.12.dist-info → pywebexec-1.6.13.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
@@ -203,34 +203,22 @@ def decode_line(line: bytes) -> str:
|
|
203
203
|
return ""
|
204
204
|
|
205
205
|
|
206
|
-
def
|
207
|
-
"""last non empty line
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
last_pos = 0
|
212
|
-
while line in ["", "\n", "\r"] and size < maxsize:
|
213
|
-
try: # catch if file empty / only empty lines
|
214
|
-
if last_pos:
|
215
|
-
fd.seek(last_pos-2, os.SEEK_SET)
|
216
|
-
while fd.read(1) not in [b"\n", b"\r"] and size < maxsize:
|
217
|
-
fd.seek(-2, os.SEEK_CUR)
|
218
|
-
size += 1
|
206
|
+
def get_last_line(file_path, maxsize=1024):
|
207
|
+
"""Retrieve last non empty line after vt100 interpretation"""
|
208
|
+
with open(file_path, 'rb') as fd:
|
209
|
+
try:
|
210
|
+
fd.seek(-maxsize, os.SEEK_END)
|
219
211
|
except OSError:
|
220
212
|
fd.seek(0)
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
line =
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
def get_last_non_empty_line_of_file(file_path):
|
231
|
-
"""Get the last non-empty line of a file."""
|
232
|
-
with open(file_path, 'rb') as f:
|
233
|
-
return last_line(f)
|
213
|
+
lines = fd.read().split(b"\n")
|
214
|
+
if len(lines) == 1:
|
215
|
+
return ""
|
216
|
+
line = ""
|
217
|
+
while True:
|
218
|
+
line = decode_line(lines.pop())
|
219
|
+
if line or not lines:
|
220
|
+
break
|
221
|
+
return line
|
234
222
|
|
235
223
|
|
236
224
|
def start_gunicorn(daemonized=False, baselog=None):
|
@@ -443,7 +431,7 @@ def update_command_status(command_id, updates):
|
|
443
431
|
if status_data['status'] != 'running':
|
444
432
|
output_file_path = get_output_file_path(command_id)
|
445
433
|
if os.path.exists(output_file_path):
|
446
|
-
status_data['last_output_line'] =
|
434
|
+
status_data['last_output_line'] = get_last_line(output_file_path)
|
447
435
|
with open(status_file_path, 'w') as f:
|
448
436
|
json.dump(status_data, f)
|
449
437
|
|
@@ -585,7 +573,7 @@ def read_commands():
|
|
585
573
|
if last_line is None:
|
586
574
|
output_file_path = get_output_file_path(command_id)
|
587
575
|
if os.path.exists(output_file_path):
|
588
|
-
last_line =
|
576
|
+
last_line = get_last_line(output_file_path)
|
589
577
|
commands.append({
|
590
578
|
'command_id': command_id,
|
591
579
|
'status': status['status'],
|
pywebexec/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=4spIsVaF8RJt8S58AG_wWoORRNkws9Iwqprj27C3ljM,99
|
2
|
-
pywebexec/pywebexec.py,sha256=
|
3
|
-
pywebexec/version.py,sha256=
|
2
|
+
pywebexec/pywebexec.py,sha256=hE7O0lZgg_nMk1VIFlBUv6lJ6T5sJFFBycnDmVnRQg4,32518
|
3
|
+
pywebexec/version.py,sha256=F6yOQF2i7n8OMZVy5diTWAk2RoBPwyUW2P5AsaXwnHo,413
|
4
4
|
pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
|
5
5
|
pywebexec/static/css/style.css,sha256=MJHUBpjWL4sLxM7a7DxypmPKaFJQbmA_ESNXsbLviNI,8201
|
6
6
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
@@ -33,9 +33,9 @@ pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCf
|
|
33
33
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
pywebexec/templates/index.html,sha256=5h8kLyzAhbvUDU9sEwrGIvD6FxAMcDZLXlN-ldlO8KU,2880
|
35
35
|
pywebexec/templates/popup.html,sha256=3ZqQcE9mYs-RXv0Lfb24zntOlvR137ZYI9mtCZNVAo0,1407
|
36
|
-
pywebexec-1.6.
|
37
|
-
pywebexec-1.6.
|
38
|
-
pywebexec-1.6.
|
39
|
-
pywebexec-1.6.
|
40
|
-
pywebexec-1.6.
|
41
|
-
pywebexec-1.6.
|
36
|
+
pywebexec-1.6.13.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
37
|
+
pywebexec-1.6.13.dist-info/METADATA,sha256=zXXihO8zyUycPpw9EBZK_YbKa9-P4PcHR-RPPPSQ-Qc,8001
|
38
|
+
pywebexec-1.6.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
39
|
+
pywebexec-1.6.13.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
40
|
+
pywebexec-1.6.13.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
41
|
+
pywebexec-1.6.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|