diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-30 19:31:06 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-30 19:31:06 +0700 |
| commit | 4726a28cee89f542eb3b0569639069a05d1df6b0 (patch) | |
| tree | 8ba5cd33f4f53387f183464088f98d556a9a7e45 /awwan.go | |
| parent | 5b6f533771e01e992e471d0e777d542c1526cf10 (diff) | |
| download | awwan-4726a28cee89f542eb3b0569639069a05d1df6b0.tar.xz | |
all: log all execution into file
For each script execution, a file suffixed with ".log" will be created
in the same directory with the same name as script file.
For example, if the script is path is "a/b/c.aww" then the log file
would named "a/b/c.aww.log".
This is to provides history and audit in the future.
Diffstat (limited to 'awwan.go')
| -rw-r--r-- | awwan.go | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -177,12 +177,6 @@ func (aww *Awwan) Local(req *Request) (err error) { sessionDir string ) - req.scriptPath = filepath.Clean(req.Script) - req.scriptPath, err = filepath.Abs(req.scriptPath) - if err != nil { - return fmt.Errorf("%s: %w", logp, err) - } - sessionDir = filepath.Dir(req.scriptPath) ses, err = NewSession(aww, sessionDir) @@ -210,7 +204,7 @@ func (aww *Awwan) Local(req *Request) (err error) { log.Printf(`%s: %s`, logp, errRemove) } - req.mlog.Flush() + req.close() }() var pos linePosition @@ -244,12 +238,6 @@ func (aww *Awwan) Play(req *Request) (err error) { sshSection *config.Section ) - req.scriptPath = filepath.Clean(req.Script) - req.scriptPath, err = filepath.Abs(req.scriptPath) - if err != nil { - return fmt.Errorf("%s: %w", logp, err) - } - sessionDir = filepath.Dir(req.scriptPath) ses, err = NewSession(aww, sessionDir) @@ -285,7 +273,7 @@ func (aww *Awwan) Play(req *Request) (err error) { defer func() { ses.sshc.rmdirAll(ses.sshc.dirTmp) - req.mlog.Flush() + req.close() }() var pos linePosition |
