Forum Discussion

firelizzard's avatar
firelizzard
New Contributor
3 years ago

Calling the CLI from a Go program

I'm working on a Go program and I want to call op, using the PolKit/app integration so a dialog appears prompting the user to type in their password. This works when I run op directly from my shell, but it does not work when I exec op from my Go program. So far what I have is effectively exec.Command("/usr/local/bin/op", ...).Output(). However, that is failing with [ERROR] 2022/12/05 14:23:19 error initializing client: connecting to desktop app: read: connection reset, make sure the CLI is correctly installed and Connect with 1Password CLI is enabled in the 1Password app. All --debug does is add DEBUG | NM request: NmRequestAccounts.


1Password Version: CLI 2.7.3, desktop 8.9
Extension Version: 2.3.8
OS Version: Gentoo Linux
Browser:_ Firefox

22 Replies

  • Jack_P_1P's avatar
    Jack_P_1P
    Icon for 1Password Team rank1Password Team

    Hi firelizzard:

    Thanks for reaching out about this. This is something we're aware of, and I've added you as affected to our internal tracking issue.

    Jack

    ref: dev/core/core#18349

  • firelizzard's avatar
    firelizzard
    New Contributor

    I figured it out. Both the executable that calls op and the directory that executable is in must be owned by root.