sampler icon indicating copy to clipboard operation
sampler copied to clipboard

Macos ssh pty error

Open celestial-30 opened this issue 3 years ago • 8 comments

Running sampler on darwin. Installed via homebrew.

Attempting to include a box that connects to local server via ssh. Copied config from github page as follows.

textboxes:
  - title: SSH
    pty: true
    init: ssh -i ~/.ssh/id_rsa [email protected]
    sample: top

With the server address replaced with the appropriate username and address.

This returns the error:

┌──────────────────────────────────────────────────────────────────┐     │
│     │                         SAMPLING FAILURE                         │     │
│     │    fork/exec /bin/sh: Setctty set but Ctty not valid in child    │     │
│     └──────────────────────────────────────────────────────────────────┘panic: runtime error: invalid memory address or nil pointer dereference              │
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x102505a98]     │
│                                                                              │
goroutine 37 [running]:                                                        │
io.WriteString(0x0, 0x0, 0x140001c4098, 0x5, 0x0, 0x140001c4098, 0x5)──────────┘
	/opt/homebrew/Cellar/go/1.15.6/libexec/src/io/io.go:311 +0xa8
github.com/sqshq/sampler/data.(*PtyInteractiveShell).execute(0x140001dc190, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/sampler-20201225-38055-jays8r/sampler-1.1.0/data/int_pty.go:70 +0xdc
github.com/sqshq/sampler/data.(*Item).nextValue(0x14000192080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)config.ymlet alerts   (<->) selection   (p) pause   (q) quit
	/private/tmp/sampler-20201225-38055-jays8r/sampler-1.1.0/data/item.go:57 +0x58
github.com/sqshq/sampler/data.(*Sampler).sample(0x140000bc7e0, 0x14000192080, 0x140000a0720, 0x0, 0x0, 0x0, 0x0)
	/private/tmp/sampler-20201225-38055-jays8r/sampler-1.1.0/data/sampler.go:59 +0x44
created by github.com/sqshq/sampler/data.NewSampler.func1
	/private/tmp/sampler-20201225-38055-jays8r/sampler-1.1.0/data/sampler.go:35 +0x78

My terminal also does not accept scrolling or clicking after this error, instead writing the codes for those actions to the prompt. This continues until I reload or switch my shell.

This error does not occur if i remove pty: true, however, if i do so it instead brings up the wake text of the server.

I believe this is caused by some issue with the pseudoterminal, But I am not experienced enough on that subject to provide any more meaningful analysis. If you need any more information please let me know.

celestial-30 avatar Apr 22 '22 04:04 celestial-30

I do not know if sampler produces logs, if it does, does anyone know where to find them?

celestial-30 avatar Apr 22 '22 04:04 celestial-30

I confirm having exact same issue.

EsEnZeT avatar Sep 30 '22 19:09 EsEnZeT

I can also confirm this exact error. Installed via brew and tried to run the ssh example..

oversize avatar Oct 14 '22 09:10 oversize

I've having the same issue, but on Ubuntu (however also installed with Brew). The term is messed up until I type "reset".

gregfr avatar Nov 20 '22 15:11 gregfr

Same bug here! Would love this for monitoring my dev environment but sadly is unusable without PTY feature for me.

zliebersbach avatar Dec 21 '22 22:12 zliebersbach

I have the same problem on macos and linux(

sikmir avatar Dec 07 '23 18:12 sikmir

Proposed fix here: https://github.com/sqshq/sampler/pull/134. The issue seems to have been fixed in creak/pty but sampler is using an older fork kr/pty. The pr change the dependency to the upstream project creak/pty. It solves the issue for me.

bebsworthy avatar Feb 22 '24 10:02 bebsworthy

Proposed fix here: #134. The issue seems to have been fixed in creak/pty but sampler is using an older fork kr/pty. The pr change the dependency to the upstream project creak/pty. It solves the issue for me.

It works for me!

sikmir avatar Mar 21 '24 18:03 sikmir