From 2dbd22114b4906c6ae60de15f4c30a5ea38441c6 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 4 Dec 2021 00:07:41 +0100 Subject: Fixed standard input error handling --- pkg/pointer/exec.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pkg/pointer/exec.go') diff --git a/pkg/pointer/exec.go b/pkg/pointer/exec.go index 8bb9dba..55020fa 100644 --- a/pkg/pointer/exec.go +++ b/pkg/pointer/exec.go @@ -177,9 +177,17 @@ func (p *Pointer) eval(c int, f *field.Field) (done bool, returnValue *int) { case ',': p.CharacterOutput(p.ss.head.Pop()) case '&': - p.ss.head.Push(p.DecimalInput()) + if v, err := p.DecimalInput(); err != nil { + p.Reverse() + } else { + p.ss.head.Push(v) + } case '~': - p.ss.head.Push(p.CharacterInput()) + if v, err := p.CharacterInput(); err != nil { + p.Reverse() + } else { + p.ss.head.Push(v) + } case 'y': n := p.ss.head.Pop() now := time.Now() -- cgit v1.2.3