]> git.giacomolli.uk - onechat/blobdiff - terminal.go
Sync agent queue replacements before success
[onechat] / terminal.go
index da0d78aa4fb6c95160ed1f42fb77631820a426d2..340a8aa1e54118ecff9a06feffd3a93acc905119 100644 (file)
@@ -30,13 +30,13 @@ var errTerminalDaemonClosed = errors.New("the daemon closed the connection")
 func terminal(ctx context.Context, in io.Reader, out io.Writer) error {
        dir, err := dataDir()
        if err != nil {
 func terminal(ctx context.Context, in io.Reader, out io.Writer) error {
        dir, err := dataDir()
        if err != nil {
-               return err
+               return fmt.Errorf("find data directory: %w", err)
        }
 
        path := filepath.Join(dir, socketFileName)
        err = checkSocketPath(path)
        if err != nil {
        }
 
        path := filepath.Join(dir, socketFileName)
        err = checkSocketPath(path)
        if err != nil {
-               return err
+               return fmt.Errorf("check terminal socket path: %w", err)
        }
 
        var dialer net.Dialer
        }
 
        var dialer net.Dialer
@@ -46,7 +46,12 @@ func terminal(ctx context.Context, in io.Reader, out io.Writer) error {
                return fmt.Errorf(`connect to the daemon (start it with "onechat daemon"): %w`, err)
        }
 
                return fmt.Errorf(`connect to the daemon (start it with "onechat daemon"): %w`, err)
        }
 
-       return terminalSession(ctx, conn, in, out)
+       err = terminalSession(ctx, conn, in, out)
+       if err != nil {
+               return fmt.Errorf("run terminal session: %w", err)
+       }
+
+       return nil
 }
 
 // terminalSession runs the client on conn until the input ends, the daemon
 }
 
 // terminalSession runs the client on conn until the input ends, the daemon