neugram / ng

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

ng panics on interrupts #224

Open vmarkovtsev opened 6 years ago

vmarkovtsev commented 6 years ago

I run the following code:

#!ng

import "encoding/csv"
import "os"

csv.NewReader(os.Stdin)

and press "Ctrl-C" having launched the script and before it prints

&csv.Reader{
    Comma: int32(44),
    r: unexported,
}

I get

ng: neugram panic: gotool: [build -buildmode=plugin ng-plugin-encoding_csv-0.go]: signal: interrupt

ng eval panic: reflect: call of reflect.Value.Type on zero Value
goroutine 1 [running]:
runtime/debug.Stack(0x41, 0x0, 0x0)
    /usr/lib/go-1.9/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
    /usr/lib/go-1.9/src/runtime/debug/stack.go:16 +0x22
neugram.io/ng/eval.(*Program).Eval.func1(0xc4200fc200, 0xc4202e9790, 0xc4202e9778)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:476 +0x204
panic(0xbb0f60, 0xc42038f600)
    /usr/lib/go-1.9/src/runtime/panic.go:491 +0x283
reflect.Value.Type(0x0, 0x0, 0x0, 0xc42038f5e0, 0x1)
    /usr/lib/go-1.9/src/reflect/value.go:1694 +0x1a3
neugram.io/ng/eval.(*Program).prepCall(0xc4200fc200, 0xc42037b1d0, 0xc4202e82d0, 0x4, 0x6, 0x1, 0x2, 0x0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1381 +0x199
neugram.io/ng/eval.(*Program).evalExpr(0xc4200fc200, 0x1159c80, 0xc42037b1d0, 0x0, 0x0, 0x0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:1492 +0x440c
neugram.io/ng/eval.(*Program).evalStmt(0xc4200fc200, 0x115a640, 0xc42006fef0, 0x0, 0x0, 0x0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:885 +0x4655
neugram.io/ng/eval.(*Program).Eval(0xc4200fc200, 0x115a640, 0xc42006fef0, 0xc4201440c0, 0x0, 0x0, 0x0, 0x11535c0, 0xc4200e87e0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/eval/eval.go:497 +0x38c
main.handleResult(0x1, 0xc4200e8790, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:393 +0x7ff
main.runFile(0xc4201020a8, 0x7, 0xc4201020a8, 0x0)
    /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:286 +0x2b5
main.main()
    /home/vadim/Projects/go_unix/src/neugram.io/ng/ng.go:131 +0x4b2
ng: ng eval panic: reflect: call of reflect.Value.Type on zero Value
go version

go version go1.9.2 linux/amd64