Skip to content

Commit 9a09746

Browse files
committed
Update Compiler.Backend.run to require command to be passed on child process init.
1 parent b2f6e67 commit 9a09746

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/Compiler/Backend.gren

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,12 @@ type alias RunOptions msg =
267267
}
268268

269269

270-
{-| Execute the compiler blob. The blob will write to stdout and stderr. There's currently no way
270+
{-| Execute the compiler backend. The backend will write to stdout and stderr. There's currently no way
271271
to redirect what is written to these streams.
272+
273+
The `encodedCommand` should be fed to the backend's stdin stream on initialization.
272274
-}
273-
run : ChildProcess.Permission -> RunOptions msg -> Cmd msg
275+
run : ChildProcess.Permission -> RunOptions msg -> { encodedCommand : String, command : Cmd msg }
274276
run permission options =
275277
let
276278
commandAsJson =
@@ -284,16 +286,18 @@ run permission options =
284286
else
285287
Dict.singleton "NO_COLOR" "1"
286288
in
287-
ChildProcess.spawn
288-
permission
289-
(options.pathToString options.compilerPath)
290-
[ commandAsJson ]
291-
{ ( ChildProcess.defaultSpawnOptions options.onInit options.onComplete )
292-
| shell = NoShell
293-
, environmentVariables =
294-
ChildProcess.MergeWithEnvironmentVariables colorEnvVar
295-
}
296-
289+
{ encodedCommand = commandAsJson
290+
, command =
291+
ChildProcess.spawn
292+
permission
293+
(options.pathToString options.compilerPath)
294+
[]
295+
{ ( ChildProcess.defaultSpawnOptions options.onInit options.onComplete )
296+
| shell = NoShell
297+
, environmentVariables =
298+
ChildProcess.MergeWithEnvironmentVariables colorEnvVar
299+
}
300+
}
297301

298302

299303
commandEncoder : Bool -> (Path -> String) -> Command -> Json.Value

0 commit comments

Comments
 (0)