Skip to content

Commit 694d330

Browse files
committed
Don't redirect stdin to backend when running quiet
1 parent 4e1934f commit 694d330

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/Main.gren

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,26 @@ update msg model =
259259

260260
CompilerInitialized { backendStreams, encodedCommand, quiet } ->
261261
Cmd.batch
262-
[ Stream.write encodedCommand backendStreams.input
263-
|> Task.map (\_ -> { source = model.stdin, target = backendStreams.input })
264-
|> Task.mapError
265-
(\err ->
266-
{ error = err
267-
, source = model.stdin
268-
, target = backendStreams.input
269-
}
270-
)
271-
|> Task.attempt RedirectTerminalIO
262+
[ if quiet then
263+
Stream.write encodedCommand backendStreams.input
264+
|> Task.map (\_ -> {})
265+
|> Task.onError
266+
(\e ->
267+
Stream.Log.line model.stderr (Stream.errorToString e)
268+
|> Task.andThen (\_ -> Node.exitWithCode 1)
269+
)
270+
|> Task.execute
271+
else
272+
Stream.write encodedCommand backendStreams.input
273+
|> Task.map (\_ -> { source = model.stdin, target = backendStreams.input })
274+
|> Task.mapError
275+
(\err ->
276+
{ error = err
277+
, source = model.stdin
278+
, target = backendStreams.input
279+
}
280+
)
281+
|> Task.attempt RedirectTerminalIO
272282
, if quiet then
273283
Cmd.none
274284
else

0 commit comments

Comments
 (0)