How do I kill a task / coroutine in Julia?

I have a totally same question as this:
How do I kill a task / coroutine in Julia? - Stack Overflow

I tried the same way to kill the task of the answer like:

t = @async run(``) # start a task
Base.throwto(t, InterruptException()) # stop the task

The task might be a external program written in another language.

But this didn’t work in Julia 1.1. (It was just stopping the processing at the line.)

Does anyone know a solution for it?

What do you want to happen that you’re not seeing happen? If you’re missing the garbage collection of things the task allocated, you can just assign t = nothing and it’ll then eventually collect all that trash.

Hi. @mbauman I would like to kill the task which is executed by async.
But when I do nothing, the task is still running after finishing the julia script.