Skip to content

x/crypto/ssh: Return better error message for non-zero exit codes #14251

Closed
@variadico

Description

@variadico

Version
go version go1.5.3 darwin/amd64

What I did
I executed a script on a remote server through SSH.

if err := sesh.Run("/home/jaime/fail.sh"); err != nil {
    log.Println(err)
}

This is fail.sh.

#!/bin/sh
exit 1

What I expected to see
I expected to see a clear and concise error. Maybe something like: Process exited with: 1.

What I saw instead
I saw a slightly confusing and half-useless error: Process exited with: 1. Reason was: ()

The code in question is here, crypto/ssh/session.go:604. This is happening because it's Sprintfing empty w.msg and w.signal values. This doesn't seem right.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions