Skip to content

Error when building on windows #106

Description

@SakiiR

When building my ssh server on windows ... I get those errors:

./make.sh                         (*master+13) 15:29:46
[~] Compiling 
#
internal/pkg/ssh/ssh.go:17:17: not enough arguments in call to syscall.Syscall
internal/pkg/ssh/ssh.go:17:18: undefined: syscall.SYS_IOCTL
internal/pkg/ssh/ssh.go:17:53: undefined: syscall.TIOCSWINSZ
internal/pkg/ssh/ssh.go:36:13: undefined: pty.Start
An error has occurred! Aborting the script execution...

I guess this is because I am using pty and stuff in my handler ...

func giveShell(s ssh.Session) {
	cmd := exec.Command(getOSCommand())
	ptyReq, winCh, isPty := s.Pty()
	if isPty {
		cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", ptyReq.Term))
		f, err := pty.Start(cmd)
		if err != nil {
			panic(err)
		}
		go func() {
			for win := range winCh {
				setWinsize(f, win.Width, win.Height)
			}
		}()
		go func() {
			io.Copy(f, s) // stdin
		}()
		io.Copy(s, f) // stdout
	} else {
		io.WriteString(s, "No PTY requested.\n")
		s.Exit(1)
	}
}

Is there any way to do cross platform command execution ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions