1414 *    3. The name of the University may not be used to endorse or promote 
1515 *       products derived from this software without specific prior 
1616 *       written permission. 
17-  *   
17+  * 
1818 * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS'' AND ANY EXPRESS OR 
1919 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
2020 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
@@ -55,7 +55,7 @@ namespace Nemerle.CommandlineCompiler
5555
5656    Platform : int  = Environment.OSVersion.Platform :> int ;
5757    IsUnix : bool  = IO.Path.DirectorySeparatorChar == ' /'  ;
58-      
58+ 
5959    public  Main() : void 
6060    {
6161      def  is64bitProcess = IntPtr.Size == 8 ;
@@ -65,24 +65,24 @@ namespace Nemerle.CommandlineCompiler
6565        Environment.Is64BitOperatingSystem
6666      #else 
6767        if  (!IsUnix)
68-         {           
69-           Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITECTURE"  ) == " AMD64"   ||  
68+         {
69+           Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITECTURE"  ) == " AMD64"   ||
7070          Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITEW6432"  ) == " AMD64" 
7171        }
7272        else 
7373        {
7474          def  unameProcess = Process();
7575          unameProcess.StartInfo.UseShellExecute = false;
76-           unameProcess.StartInfo.CreateNoWindow = false;           
76+           unameProcess.StartInfo.CreateNoWindow = false;
7777          unameProcess.StartInfo.FileName = " /bin/uname"  ;
7878          unameProcess.StartInfo.Arguments = " -m"  ;
7979          unameProcess.StartInfo.RedirectStandardOutput = true;
80-            
80+ 
8181          if  (unameProcess.Start())
8282          {
8383            def  output = unameProcess.StandardOutput.ReadToEnd();
8484            unameProcess.WaitForExit();
85-              
85+ 
8686	    unameProcess.ExitCode == 0  && output.Contains(" x64"  )
8787          }
8888          else 
@@ -149,7 +149,7 @@ namespace Nemerle.CommandlineCompiler
149149      else 
150150        main_with_catching()
151151    }
152-      
152+ 
153153    needs_bigger_stack() : bool 
154154    {
155155      typeof (object ).Assembly.GetType(" System.RuntimeType"  ) != null ||
@@ -168,35 +168,26 @@ namespace Nemerle.CommandlineCompiler
168168      }
169169      catch 
170170      {
171-         | e is  IO.FileNotFoundException =>
172-           Message.Error (e.Message)
173-         | e is  Recovery =>
174-           bomb (e, " got Recovery exception"  )
175-         | e is  BailOutException =>
176-           bomb (e, " got bail out exception"  )
177-         | e is  ArgumentException =>
178-           bomb (e, " got ArgumentException ("   +  e.Message +  " )"  )
179-         | e is  MatchFailureException =>
180-           bomb (e, " got MatchFailureException exception"  )
181-         | e is  ICE =>
182-           bomb (e, e.Message)
183-         | e is  AssertionException =>
184-           bomb (e, e.Message)
185-         | _  is  AssemblyFindException =>
186-           Environment.Exit (3 );
187-         | e =>
188-           bomb (e, $ " got some unknown exception of type $(e.GetType()): $(e.Message)"  )
171+         | e is  IO.FileNotFoundException => bomb(e, e.Message)
172+         | e is  Recovery                 => bomb(e, " got Recovery exception"  )
173+         | e is  BailOutException         => bomb(e, " got bail out exception"  )
174+         | e is  ArgumentException        => bomb(e, " got ArgumentException ("   +  e.Message +  " )"  )
175+         | e is  MatchFailureException    => bomb(e, " got MatchFailureException exception"  )
176+         | e is  ICE                      => bomb(e, e.Message)
177+         | e is  AssertionException       => bomb(e, e.Message)
178+         | e is  AssemblyFindException    => bomb(e, e.Message, exitValue=3 )
179+         | e                             => bomb(e, $ " got some unknown exception of type $(e.GetType()): $(e.Message)"  )
189180      }
190181
191182      Message.MaybeBailout();
192183    }
193-      
194-     bomb  (e : Exception, msg : string ) : void 
184+ 
185+     bomb(e : Exception, msg : string , exitValue :  int  =  2 ) : void 
195186    {
196-       Manager.KillProgressBar  ();
197-       Message.MaybeBailout  (true);
198-       Message.Error (sprintf ( " internal compiler error: %s \n %s \n "  , msg, e.StackTrace) );
199-       Environment.Exit(2 );
187+       Manager.KillProgressBar();
188+       Message.MaybeBailout(true);
189+       Message.Error($<# internal  compiler error: $msg. $(e.StackTrace.Replace( " \r \n"  , " ¦ " ).Replace( " \n " ,  " ¦ " ))#> );
190+       Environment.Exit(exitValue );
200191    }
201192
202193    parse_command_line() : void 
0 commit comments