Call as non-admin if gksudo and kdesu aren't available.

This commit is contained in:
Paul Chote
2011-01-27 18:36:21 +13:00
parent 1474cd147a
commit 817ac42954

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Utility
else if (File.Exists("/usr/bin/kdesudo"))
CallWithAdminKDE(command);
else
CallWithAdminWindows(command);
CallWithoutAdmin(command);
break;
default:
CallWithAdminWindows(command);
@@ -160,5 +160,23 @@ namespace OpenRA.Utility
Console.Write(reader.ReadLine());
}
}
static void CallWithoutAdmin(string command)
{
var p = new Process();
p.StartInfo.FileName = "mono";
p.StartInfo.Arguments = "OpenRA.Utility.exe " + command;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
using (var reader = p.StandardOutput)
{
while(!p.HasExited)
{
Console.WriteLine(reader.ReadLine());
}
}
}
}
}