Exemplo n.º 1
0
        static int RunVerb(IVerb verb)
        {
            try
            {
                return(verb.Run());
            }
            catch (Exception e)
            {
                switch (e.HResult)
                {
                case NativeApi.HRESULT_ERROR_ALREADY_EXISTS:
                    Console.WriteLine("The distribution installation has become corrupted.");
                    Console.WriteLine("Please select Reset from App Settings or uninstall and reinstall the app.");
                    break;

                case NativeApi.HRESULT_ERROR_LINUX_SUBSYSTEM_NOT_PRESENT:
                case NativeApi.COR_E_DLLNOTFOUND:
                    Console.WriteLine("The Windows Subsystem for Linux optional component is not enabled. Please enable it and try again.");
                    Console.WriteLine("See https://aka.ms/wslinstall for details.");
                    break;

                default:
                    Console.WriteLine(e);
                    break;
                }
                return(1);
            }
        }