#114·sampler

Macos ssh pty error

Author: celestial-30Created Apr 22, 2022Updated Mar 21, 2024

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.