Skip to content
Snippets Groups Projects
Commit efc54773 authored by Samuel Pitoiset's avatar Samuel Pitoiset Committed by Timothee Besset
Browse files

fix copying RGP captures by checking for completion

Waiting 0.1s before starting the copy over SSH isn't enough because
the trace might not be completely written on disk and this can copy
corrupted captures.

To fix this, wait for completion by checking the RGP capture size
over SSH. This is simple and should be robust enough. An alternative
solution would be inotify but inotifywait isn't installed on Deck.

Closes: #3
parent 1f3f8d34
No related branches found
No related tags found
No related merge requests found
......@@ -1473,6 +1473,20 @@ def rgp_capture(args):
while attempts > 0:
time.sleep(.1)
attempts -= 1
# Wait for completion by checking the RGP capture size.
filesize = 0
while True:
out_text, err_text, exit_status = _simple_ssh(ssh, 'ls -1ts --block-size=1 /tmp/*.rgp', silent=True)
if exit_status != 0:
break;
new_filesize = out_text.split(' ')[0]
if new_filesize == filesize:
# RGP capture is complete.
break;
filesize = new_filesize
time.sleep(.1)
out_text, err_text, exit_status = _simple_ssh(ssh, 'ls -1t /tmp/*.rgp', silent=True)
if exit_status == 0:
remote_path = out_text.split('\n')[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment