Skip to content

Commit

Permalink
plotextractor: fix run_process_with_timeout calls
Browse files Browse the repository at this point in the history
* Changes argument types given to a shellutils function
  run_process_with_timeout() to run a process with timeout,
  in order to comply with recent API changes of that function.
  • Loading branch information
jalavik authored and tiborsimko committed Apr 28, 2011
1 parent f3764f5 commit 920396b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions modules/miscutil/lib/plotextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,8 @@ def rotate_image(filename, line, sdir, image_list):
return False

degrees = str(0 - int(degrees))

dummy, dummy, cmd_err = run_process_with_timeout('mogrify -rotate %s %s' % \
(degrees, file_loc), shell=True)
cmd_list = ['mogrify', '-rotate', degrees, file_loc]
dummy, dummy, cmd_err = run_process_with_timeout(cmd_list)
if cmd_err != '':
return True
else:
Expand Down
13 changes: 6 additions & 7 deletions modules/miscutil/lib/plotextractor_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def untar(original_tarball, sdir):
if re.search(tarball_output, cmd_out) == None:
run_shell_command('rm %s', (tarball,))
return ([], [], None)
dummy1, cmd_out, cmd_err = run_process_with_timeout('tar xvf %s -C %s' %
(tarball, sdir), shell=True)
cmd_list = ['tar', 'xvf', tarball, '-C', sdir]
dummy1, cmd_out, cmd_err = run_process_with_timeout(cmd_list)

if cmd_err != '':
return ([], [], None)
Expand Down Expand Up @@ -181,10 +181,9 @@ def convert_images(image_list):
# for sure it can do EPS->PNG and JPG->PNG and PS->PNG
# and PSTEX->PNG
converted_image_file = get_converted_image_name(image_file)
cmd_list = ['convert', image_file, converted_image_file]
try:
dummy1, cmd_out, cmd_err = run_process_with_timeout('convert %s %s'\
% (image_file, \
converted_image_file), shell=True)
dummy1, cmd_out, cmd_err = run_process_with_timeout(cmd_list)
if cmd_err == '':
ret_list.append(converted_image_file)
else:
Expand All @@ -205,8 +204,8 @@ def extract_text(tarball):
"""
try:
os.stat(tarball + '.pdf')
dummy1, dummy2, cmd_err = run_process_with_timeout('pdftotext %s %s' % \
(tarball + '.pdf ', tarball + '.txt'), shell=True)
cmd_list = ['pdftotext', tarball + '.pdf ', tarball + '.txt']
dummy1, dummy2, cmd_err = run_process_with_timeout(cmd_list)
if cmd_err != '':
return - 1
write_message('generated ' + tarball + '.txt from ' + tarball + '.pdf')
Expand Down

0 comments on commit 920396b

Please sign in to comment.