From f430c3581f55e767bb0b742049443e65b8eccf9f Mon Sep 17 00:00:00 2001
From: Nikos Kouremenos <kourem@gmail.com>
Date: Tue, 25 Oct 2005 08:39:41 +0000
Subject: [PATCH] ask uname as our last chance to detect OS [thanks kael for
 command]

---
 src/common/connection.py |  5 +++++
 src/common/helpers.py    | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/src/common/connection.py b/src/common/connection.py
index 45411e1958..7f21593b34 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -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:
diff --git a/src/common/helpers.py b/src/common/helpers.py
index 8ef6dc2104..20613a9948 100644
--- a/src/common/helpers.py
+++ b/src/common/helpers.py
@@ -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
-- 
GitLab