neugram / ng

scripting language integrated with Go
https://neugram.io
BSD 2-Clause "Simplified" License
917 stars 43 forks source link

ng/eval: run top-level defers before exiting interpreter #238

Open sbinet opened 6 years ago

sbinet commented 6 years ago

with #218 merged in, we still need to have the top-level defers run before properly closing/exiting the interpreter.

Right now, we get this:

$> ng
ng> defer printf("hello\n")
ng> ^D
$>  

whereas, it should be:

$> ng
ng> defer printf("hello\n")
ng> ^D
hello
$>