Mercurial > libervia-backend
comparison sat_frontends/jp/cmd_avatar.py @ 2883:7e8ca7c1429a
jp (avatar/get): fixed avatar being displayed 2 times in a corner case:
when avatar is shown by ImageMagick's display and it is terminated using SIGINT, the return code is 2 and not 0.
Before this patch, jp was interpreting the 2 as an image not displayed and so was trying with the next available command
Now it is stopping when exit code 2 is received.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 05 Apr 2019 21:22:05 +0200 |
parents | 003b8b4b56a7 |
children | ab2696e34d29 |
comparison
equal
deleted
inserted
replaced
2882:0c54970d8e6e | 2883:7e8ca7c1429a |
---|---|
86 try: | 86 try: |
87 ret = subprocess.call([cmd] + [path]) | 87 ret = subprocess.call([cmd] + [path]) |
88 except OSError: | 88 except OSError: |
89 pass | 89 pass |
90 else: | 90 else: |
91 if ret == 0: | 91 if ret in (0, 2): |
92 # we can get exit code 2 with display when stopping it with C-c | |
92 break | 93 break |
93 else: | 94 else: |
94 # didn't worked with commands, we try our luck with webbrowser | 95 # didn't worked with commands, we try our luck with webbrowser |
95 # in some cases, webbrowser can actually open the associated display program | 96 # in some cases, webbrowser can actually open the associated display program |
96 import webbrowser | 97 import webbrowser |