@@ -159,7 +159,7 @@ type Msg
159159 | CompilerInstalled (Result FileSystem.Error Path)
160160 | CompilerInitialized { quiet : Bool, backendStreams : ChildProcess.StreamIO, encodedCommand : Bytes }
161161 | CompilerRan Int
162- | CompiledForRun { path : String , exitCode : Int }
162+ | CompiledForRun { path : Path , exitCode : Int }
163163 | RunStarted Process.Id
164164 | RunExited Int
165165 | RedirectTerminalIO
@@ -271,14 +271,16 @@ update msg model =
271271 Terminal.Run.run
272272 { cpPermission = model.cpPermission
273273 , fsPermission = model.fsPermission
274+ , pathToString = model.pathToString
274275 , path = path
275276 , onInit = RunStarted
276277 , onExit = RunExited
277278 }
278279 |> Task.onError
279280 (\error ->
280- -- TODO: Terminal.Run.errorToString
281- Stream.Log.line model.stderr (Debug.toString error)
281+ Terminal.Run.prettifyError error
282+ |> Terminal.Help.prettyPrint { useColor = model.useColor }
283+ |> Stream.Log.line model.stderr
282284 |> Task.map (\_ -> Node.exitWithCode 1)
283285 )
284286 |> Task.executeCmd
@@ -455,14 +457,15 @@ parseUserArgs model compilerPath =
455457 )
456458 |> Task.executeCmd
457459
458- CliParser.Run moduleName ->
460+ CliParser.Run opts ->
459461 Terminal.Run.make
460462 { fsPermission = model.fsPermission
461463 , cpPermission = model.cpPermission
462464 , useColor = model.useColor
463465 , compilerPath = compilerPath
464466 , pathToString = model.pathToString
465- , moduleName = moduleName
467+ , moduleName = opts.moduleName
468+ , package = opts.package
466469 , onBackendInitialized =
467470 (\{ backendStreams, encodedCommand } ->
468471 CompilerInitialized
@@ -474,16 +477,17 @@ parseUserArgs model compilerPath =
474477 , onCompiled =
475478 (\outputPath exitCode ->
476479 CompiledForRun
477- { path = model.pathToString outputPath
480+ { path = outputPath
478481 , exitCode = exitCode
479482 }
480483 )
481484 }
482485 |> Task.onError
483- (\err ->
484- Stream.Log.line model.stdout (Debug.toString err)
485- |> Task.execute
486- |> Task.succeed
486+ (\error ->
487+ Terminal.Run.prettifyError error
488+ |> Terminal.Help.prettyPrint { useColor = model.useColor }
489+ |> Stream.Log.line model.stderr
490+ |> Task.map (\_ -> Node.exitWithCode 1)
487491 )
488492 |> Task.executeCmd
489493
0 commit comments