aboutsummaryrefslogtreecommitdiff
path: root/session.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-10-12 01:30:19 +0700
committerShulhan <ms@kilabit.info>2023-10-12 01:40:22 +0700
commit207e7f016bf96ab037f510837940c037111cd42f (patch)
tree1f28958f818da44ebcf6548bb081418e60fb11c2 /session.go
parent6b756d144c5cdb0a0c9b5f8a70b3c936a75f28c9 (diff)
downloadawwan-207e7f016bf96ab037f510837940c037111cd42f.tar.xz
all: return error from executeScriptOnLocal
Instead of breaking the statement when its failed to execute, return the error to the caller, Local.
Diffstat (limited to 'session.go')
-rw-r--r--session.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/session.go b/session.go
index d68637a..86d4fae 100644
--- a/session.go
+++ b/session.go
@@ -309,7 +309,7 @@ func (ses *Session) executeRequires(req *Request, pos linePosition) (err error)
return nil
}
-func (ses *Session) executeScriptOnLocal(req *Request, pos linePosition) {
+func (ses *Session) executeScriptOnLocal(req *Request, pos linePosition) (err error) {
var max = int64(len(req.script.stmts))
if pos.start > max {
return
@@ -332,7 +332,6 @@ func (ses *Session) executeScriptOnLocal(req *Request, pos linePosition) {
fmt.Fprintf(req.stdout, "\n--> local: %3d: %s\n", x, stmt.String())
- var err error
switch stmt.kind {
case statementKindDefault:
err = ses.ExecLocal(req, stmt)
@@ -347,9 +346,10 @@ func (ses *Session) executeScriptOnLocal(req *Request, pos linePosition) {
}
if err != nil {
fmt.Fprintf(req.stderr, "!!! %s\n", err)
- break
+ return err
}
}
+ return nil
}
func (ses *Session) executeScriptOnRemote(req *Request, pos linePosition) {