ask uname as our last chance to detect OS [thanks kael for command]
This commit is contained in:
parent
0109d921ac
commit
f430c3581f
|
@ -136,6 +136,11 @@ def get_os_info():
|
|||
elif path_to_file.endswith('lfs-release'): # file just has version
|
||||
text = distro_name + ' ' + text
|
||||
return text
|
||||
|
||||
# our last chance, ask uname and strip it
|
||||
uname_output = helpers.get_output_of_command('uname -a | cut -d" " -f1,3')
|
||||
if uname_output is not None:
|
||||
return uname_output
|
||||
return 'N/A'
|
||||
|
||||
class Connection:
|
||||
|
|
|
@ -372,3 +372,15 @@ def one_account_connected():
|
|||
one_connected = True
|
||||
break
|
||||
return one_connected
|
||||
|
||||
def get_output_of_command(command):
|
||||
try:
|
||||
child_stdin, child_stdout = os.popen2(command)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
output = child_stdout.readlines()
|
||||
child_stdout.close()
|
||||
child_stdin.close()
|
||||
|
||||
return output
|
||||
|
|
Loading…
Reference in New Issue