core
core copied to clipboard
Trying to kill a Process that has already run will cause Javascript Error
Sscce
https://ellie-app.com/4J8FNh7TMa1/2 https://ellie-app.com/5986pv2Mma1/0 by @zwilias
Error
TypeError: null is not an object (evaluating 'root.ctor')
Possibly related
#706
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
This is still an issue in elm 0.19.
Here is @zwilias's sscce updated for 0.19:
module Main exposing (..)
import Html exposing (text)
import Process
import Task exposing (Task)
killProcessTwice : Task Never ()
killProcessTwice =
Task.succeed ()
|> Process.spawn
|> Task.andThen
(\pid ->
Process.kill pid
|> Task.andThen (\_ -> Process.kill pid)
)
main =
Html.program
{ init =
( ()
, Task.perform (always ()) killProcessTwice
)
, view = \_ -> text "oops"
, update = \_ model -> model ! []
, subscriptions = \_ -> Sub.none
}
Running in https://ellie-app.com/3mGSw3SWLbca1 gives TypeError: task is null, can't access property "$" of it
Applogies: the sscce above has not infact been updated for elm 19.
This one has: https://ellie-app.com/4CzFx6NYkrSa1
module Main exposing (..)
import Html exposing (text)
import Process
import Task exposing (Task)
import Browser
killProcessTwice : Task Never ()
killProcessTwice =
Task.succeed ()
|> Process.spawn
|> Task.andThen
(\pid ->
Process.kill pid
|> Task.andThen (\_ -> Process.kill pid)
)
main =
Browser.element
{ init = \() ->
( ()
, Task.perform (always ()) killProcessTwice
)
, view = \_ -> text "oops"
, update = \_ model -> (model, Cmd.none)
, subscriptions = \_ -> Sub.none
}