Restart Unity from script in Mac / Windows

Is there a way to restart Unity using a script? E.g. you wan’t to restart Unity after the import of some packages. Is this possible?

I’ve found the solution:

var method = typeof(EditorApplication).GetMethod(
				"CloseAndRelaunch",
				BindingFlags.Static | BindingFlags.NonPublic);

string[] args = Environment.GetCommandLineArgs();

var methodParams = new object[] {args};

if (method != null) method.Invoke(null, methodParams);
else Log.Error("Can't restart Unity. Can’t find CloseAndRelaunch method in EditorApplication class.");