internal static int Run(string[] args) { FatalError.Handler = FailFast.OnFatalException; var responseFile = CommonCompiler.GetResponseFileFullPath(CSharpCompiler.ResponseFileName); Csc compiler = new Csc(responseFile, Directory.GetCurrentDirectory(), args); // We store original encoding and restore it later to revert // the changes that might be done by /utf8output options // NOTE: original encoding may not be restored if process terminated Encoding origEncoding = Console.OutputEncoding; try { if (compiler.Arguments.Utf8Output && Console.IsOutputRedirected) { Console.OutputEncoding = Encoding.UTF8; } return(compiler.Run(Console.Out)); } finally { try { Console.OutputEncoding = origEncoding; } catch { // Try to reset the output encoding, ignore if we can't } } }
internal static int Main(string[] args) { try { var responseFile = CommonCompiler.GetResponseFileFullPath(InteractiveResponseFileName); return(new Csi(responseFile, Directory.GetCurrentDirectory(), args).RunInteractive(Console.Out)); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(1); } }