@@ -11,6 +11,7 @@ import FileSystem.Path as Path exposing (Path)
11
11
import HttpClient
12
12
import Bytes exposing (Bytes)
13
13
import Terminal
14
+ import Process
14
15
15
16
16
17
main : Node.Program Model Msg
@@ -217,7 +218,6 @@ type Msg
217
218
= ExistanceChecked (Result FileSystem.Error Path)
218
219
| CompilerDownloaded (Result (HttpClient.Error Bytes) (HttpClient.Response Bytes))
219
220
| CompilerInstalled (Result FileSystem.Error {})
220
- | CompilerExecuted (Result ChildProcess.FailedRun ChildProcess.SuccessfulRun)
221
221
222
222
223
223
update : Msg -> Model -> { model : Model, command : Cmd Msg }
@@ -241,7 +241,7 @@ update msg model =
241
241
{ model = model
242
242
, command =
243
243
runCompiler model
244
- |> Task.attempt CompilerExecuted
244
+ |> Task.execute
245
245
}
246
246
247
247
CompilerDownloaded (Err ((HttpClient.BadStatus res) as err)) ->
@@ -308,22 +308,6 @@ update msg model =
308
308
{ model = model
309
309
, command =
310
310
runCompiler model
311
- |> Task.attempt CompilerExecuted
312
- }
313
-
314
- CompilerExecuted (Err output) ->
315
- { model = model
316
- , command =
317
- Stream.send model.stderr output.stderr
318
- |> Task.andThen (\_ -> Node.exitWithCode output.exitCode)
319
- |> Task.execute
320
- }
321
-
322
- CompilerExecuted (Ok output) ->
323
- { model = model
324
- , command =
325
- Stream.send model.stdout output.stdout
326
- |> Task.andThen (\_ -> Stream.send model.stderr output.stderr)
327
311
|> Task.execute
328
312
}
329
313
@@ -335,7 +319,7 @@ downloadBinary permission url =
335
319
|> HttpClient.send permission
336
320
337
321
338
- runCompiler : Model -> Task ChildProcess.FailedRun ChildProcess.SuccessfulRun
322
+ runCompiler : Model -> Task x Process.Id
339
323
runCompiler model =
340
324
let
341
325
colorEnvVar =
@@ -344,9 +328,8 @@ runCompiler model =
344
328
else
345
329
Dict.singleton "NO_COLOR" "1"
346
330
in
347
- ChildProcess.run model.cpPermission (model.pathToString model.localPath) model.args <|
348
- { ChildProcess.defaultRunOptions
349
- | maximumBytesWrittenToStreams = 1024 * 1024 -- 1Mb
350
- , environmentVariables =
331
+ ChildProcess.spawn model.cpPermission (model.pathToString model.localPath) model.args <|
332
+ { ChildProcess.defaultSpawnOptions
333
+ | environmentVariables =
351
334
ChildProcess.MergeWithEnvironmentVariables colorEnvVar
352
335
}
0 commit comments