Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use with custom pty example ssh #246

Open
procolost opened this issue Jun 12, 2023 · 0 comments
Open

how to use with custom pty example ssh #246

procolost opened this issue Jun 12, 2023 · 0 comments

Comments

@procolost
Copy link

Why hardcode /dev/tty in the init function?
I have a custom pty I want the library to work with it


		case "bash":
			//  terminal.MakeRaw(channel.)
			if !sta.enaMode {
				term.Write(append(term.Escape.Red, "please enable enable\n"...))
				term.Write(term.Escape.Reset)
				continue
			}
			w := exec.Command("/usr/bin/bash")

			f, fe := pty.Start(w)
			Log.Println(fe)
			w.SysProcAttr = &syscall.SysProcAttr{Setctty: true}
			go func() {
				for {
					if _, e := io.Copy(f, channel); e != nil {
						z <- true
						break
					}
				}

			}()
			go func() {
				for {
					if _, e := io.Copy(channel, f); e != nil {
						z <- true
						break
					}
				}

			}()
			// log.Println(pc)
			<-z
			if w.Process.Pid > 0 {
				w.Process.Kill()
			}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@procolost and others