Skip to main content
July 21, 2022
Question

`op run` process doesn't exit when starting process from within a custom shell-script.

  • July 21, 2022
  • 2 replies
  • 203 views

I have a script for connecting to my VPN, and use the 1Password CLI to load my password as environment variable into the script like described here: https://developer.1password.com/docs/cli/secrets-environment-variables, and i have aliased my vpn script like described here: https://developer.1password.com/docs/cli/authenticate-clis

My VPN script can basically either:
1. start an openconnect process in the background (connect to the vpn)
2. pkill the openconnect process (disconnect from the vpn)

When i connect i have a problem that the command/process hangs after the vpn-script has exited, and i am connected to the VPN.

If i enable the --no-masking flag to the alias, the process exits properly as expected.

There is no problems exiting the process when i disconnect from my VPN.

I'm wondering if you could have an explanation to what is happening with the --no-masking functionality, and why it would stop the process/command from exiting?


1Password Version: CLI v2.5.1
Extension Version: Not Provided
OS Version: Ubuntu 22.04
Browser:_ Not Provided

2 replies

1Password Employee
August 3, 2022

Hi @bizzaro, thanks for your question and sorry for the late reply. I have a couple of questions: Could you tell us which op command exactly hangs in your script? What kind of output do you expect this command to have?

All the best,
Andi

August 11, 2022

Hi, im also sorry for the late reply.

I have aliased a vpn script on my linux machine. This script starts a background task (openconnect).

It's the op run -- vpn command that doesn't exit when the vpn-script exits. If i enable --no-masking the command it exits just fine. If my script exits (and hasn't started the openconnect process, fx by adding a --help flag, the op run -- vpn also exits fine, even without --no-masking enabled.