ask uname as our last chance to detect OS [thanks kael for command]

This commit is contained in:
Nikos Kouremenos 2005-10-25 08:39:41 +00:00
parent 0109d921ac
commit f430c3581f
2 changed files with 17 additions and 0 deletions

View File

@ -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:

View File

@ -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