14
14
* 3. The name of the University may not be used to endorse or promote
15
15
* products derived from this software without specific prior
16
16
* written permission.
17
- *
17
+ *
18
18
* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS'' AND ANY EXPRESS OR
19
19
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
20
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@@ -55,7 +55,7 @@ namespace Nemerle.CommandlineCompiler
55
55
56
56
Platform : int = Environment.OSVersion.Platform :> int ;
57
57
IsUnix : bool = IO.Path.DirectorySeparatorChar == ' /' ;
58
-
58
+
59
59
public Main() : void
60
60
{
61
61
def is64bitProcess = IntPtr.Size == 8 ;
@@ -65,24 +65,24 @@ namespace Nemerle.CommandlineCompiler
65
65
Environment.Is64BitOperatingSystem
66
66
#else
67
67
if (!IsUnix)
68
- {
69
- Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITECTURE" ) == " AMD64" ||
68
+ {
69
+ Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITECTURE" ) == " AMD64" ||
70
70
Environment.GetEnvironmentVariable(" PROCESSOR_ARCHITEW6432" ) == " AMD64"
71
71
}
72
72
else
73
73
{
74
74
def unameProcess = Process();
75
75
unameProcess.StartInfo.UseShellExecute = false;
76
- unameProcess.StartInfo.CreateNoWindow = false;
76
+ unameProcess.StartInfo.CreateNoWindow = false;
77
77
unameProcess.StartInfo.FileName = " /bin/uname" ;
78
78
unameProcess.StartInfo.Arguments = " -m" ;
79
79
unameProcess.StartInfo.RedirectStandardOutput = true;
80
-
80
+
81
81
if (unameProcess.Start())
82
82
{
83
83
def output = unameProcess.StandardOutput.ReadToEnd();
84
84
unameProcess.WaitForExit();
85
-
85
+
86
86
unameProcess.ExitCode == 0 && output.Contains(" x64" )
87
87
}
88
88
else
@@ -149,7 +149,7 @@ namespace Nemerle.CommandlineCompiler
149
149
else
150
150
main_with_catching()
151
151
}
152
-
152
+
153
153
needs_bigger_stack() : bool
154
154
{
155
155
typeof (object ).Assembly.GetType(" System.RuntimeType" ) != null ||
@@ -168,35 +168,26 @@ namespace Nemerle.CommandlineCompiler
168
168
}
169
169
catch
170
170
{
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)" )
189
180
}
190
181
191
182
Message.MaybeBailout();
192
183
}
193
-
194
- bomb (e : Exception, msg : string ) : void
184
+
185
+ bomb(e : Exception, msg : string , exitValue : int = 2 ) : void
195
186
{
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 );
200
191
}
201
192
202
193
parse_command_line() : void
0 commit comments