Signing back into the Community for the first time? You'll need to reset your password to access your account. Find out more.
Forum Discussion
Former Member
2 years ago"error initializing client: connecting to desktop app: read: connection reset"
I am trying to execute the op command from a Golang app like so:
```
package main
import (
"encoding/json"
"log"
"os/exec"
)
func main() {
op := exec.Command("o...
Former Member
2 years agoThe issue is reproducible. Here is a Vagrantfile that will reproduce the issue:
```
To replicate the issue with running the op
command directly from a Golang app
Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora37"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "2048"
vb.cpus = "2"
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
end
config.vm.provision "shell", privileged: false, inline: <<~'EOF'
#!/usr/bin/env bash
set -x
sudo dnf update -y
sudo dnf group install -y "Fedora Workstation" --allowerasing
sudo systemctl enable gdm.service
sudo systemctl set-default graphical.target
sudo dnf install -y golang
sudo rpm --import https://downloads.1password.com/linux/keys/1password.asc
sudo sh -c 'echo -e "[1password]\nname=1Password Stable Channel\nbaseurl=https://downloads.1password.com/linux/rpm/stable/\$basearch\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=\"https://downloads.1password.com/linux/keys/1password.asc\"" > /etc/yum.repos.d/1password.repo'
sudo dnf install -y 1password 1password-cli
echo '
package main
import (
"log"
"os/exec"
"os"
"fmt"
)
func main() {
fmt.Println(os.Args)
var opExecutable string
if os.Args[1] == "python" {
opExecutable = "./op.py"
} else if os.Args[1] == "direct" {
opExecutable = "op"
}
op := exec.Command(opExecutable, "item", "list")
out, err := op.Output()
if e, ok := err.(*exec.ExitError); ok {
log.Fatal(e, ": ", string(e.Stderr))
}
println(string(out))
}
' > ~/main.go
echo '#!/usr/bin/env python3
import subprocess
import sys
subprocess.run(["op"] + sys.argv[1:])
' > ~/op.py
chmod +x ~/op.py
set +x
echo "Now reboot the VM with 'vagrant reload'. Once that is done, log into the VM when it loads (password is 'vagrant'), sign into 1Password"
echo "and configure it to allow connection from the CLI. Then, from the terminal in the VM, run 'op signin'."
echo "To replicate the issue, run 'go run main.go direct'. To run it though Python, run 'go run main.go python'."
EOF
end
```