@@ -5,18 +5,22 @@ defmodule Mix.CLI do
55 Runs Mix according to the command line arguments.
66 """
77 def main ( args \\ System . argv ( ) ) do
8+ if env_variable_activated? ( "MIX_DEBUG" ) do
9+ IO . puts ( "-> Running mix CLI" )
10+ { time , res } = :timer . tc ( & main / 2 , [ args , true ] )
11+ IO . puts ( [ "<- Ran mix CLI in " , Integer . to_string ( div ( time , 1000 ) ) , "ms" ] )
12+ res
13+ else
14+ main ( args , false )
15+ end
16+ end
17+
18+ defp main ( args , debug? ) do
819 Mix . start ( )
920
21+ if debug? , do: Mix . debug ( true )
1022 if env_variable_activated? ( "MIX_QUIET" ) , do: Mix . shell ( Mix.Shell.Quiet )
1123
12- debug? =
13- if env_variable_activated? ( "MIX_DEBUG" ) do
14- Mix . debug ( true )
15- true
16- else
17- false
18- end
19-
2024 if profile = System . get_env ( "MIX_PROFILE" ) do
2125 Mix.State . put ( :profile , String . split ( profile , "," ) )
2226 end
@@ -29,13 +33,6 @@ defmodule Mix.CLI do
2933 :version ->
3034 display_version ( )
3135
32- nil when debug? ->
33- shell = Mix . shell ( )
34- shell . info ( "-> Running mix CLI" )
35- { time , res } = :timer . tc ( & proceed / 1 , [ args ] )
36- shell . info ( [ "<- Ran mix CLI in " , Integer . to_string ( div ( time , 1000 ) ) , "ms" ] )
37- res
38-
3936 nil ->
4037 proceed ( args )
4138 end
0 commit comments