Package list xapp / 7214e8b
Handle exceptions in usr/bin/upload-system-info It doesn't really matter if it fails (typically when the user is offline) but if it doesn't catch the exception it can be detected by crash monitors Clement Lefebvre 4 years ago
1 changed file(s) with 12 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
11
22 import subprocess, os
33
4 inxi = subprocess.Popen(['inxi', '-Fxxrzc0'], stdout=subprocess.PIPE)
5 pastebin = subprocess.Popen(['/usr/bin/pastebin'], stdin=inxi.stdout, stdout=subprocess.PIPE)
6 inxi.stdout.close()
7 output = pastebin.communicate()[0]
8 output = output.split()[0] # if we have more than one URL, only use the first one
9 pastebin.wait()
10 subprocess.call(['xdg-open', output])
4 try:
5 inxi = subprocess.Popen(['inxi', '-Fxxrzc0'], stdout=subprocess.PIPE)
6 pastebin = subprocess.Popen(['/usr/bin/pastebin'], stdin=inxi.stdout, stdout=subprocess.PIPE)
7 inxi.stdout.close()
8 output = pastebin.communicate()[0]
9 output = output.split()[0] # if we have more than one URL, only use the first one
10 pastebin.wait()
11 subprocess.call(['xdg-open', output])
12 except Exception as e:
13 print ("An error occurred while uploading the system information:")
14 print (e)
15 print ("Please make sure you're connected to the Internet.")