Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove process.env from pass execution #15462

Merged
merged 2 commits into from
Nov 24, 2024

Conversation

camiloaromero23
Copy link
Contributor

@camiloaromero23 camiloaromero23 commented Nov 21, 2024

Description

  • Fix: Remove process.env from pass execution

This change is done due to errors in the extension using nix-darwing messing with the locales

Screencast

Screenshot 2024-11-21 at 00 31 42

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: pass Issues related to the pass extension labels Nov 21, 2024
@raycastbot
Copy link
Collaborator

raycastbot commented Nov 21, 2024

Thank you for your first contribution! 🎉

🔔 @capipo you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

You can expect an initial review within five business days.

@pernielsentikaer
Copy link
Collaborator

Could you check this @capipo

@pernielsentikaer pernielsentikaer self-assigned this Nov 21, 2024
@capipo
Copy link
Contributor

capipo commented Nov 21, 2024

Hi @pernielsentikaer.

I'm passing process.env because I need to support the PASSWORD_STORE_DIR environment variable, and potentially other variables supported by the pass command.

Perhaps if you filter out variables that start with PASSWORD_STORE we could continue to support those variables and your problem would be solved.

@capipo
Copy link
Contributor

capipo commented Nov 21, 2024

Nevermind, I see that that variable is passed later

@camiloaromero23
Copy link
Contributor Author

camiloaromero23 commented Nov 22, 2024

Hi @capipo,

I'm not really sure about that since the extension is overwriting the PASSWORD_STORE_DIR env variable. So either way, it would not use the env variable from process.env

export async function pass(cmd: string, storeDir: string = ''): Promise<string> {
  const passCmd = `pass ${cmd}`;
  const { stdout, stderr } = await execAsync(passCmd, {
    timeout: 10000,
    env: {
     ...process.env
      PATH: await envPath(),
      PASSWORD_STORE_DIR: storeDir,
    },
  });

  if (stderr) {
    throw new Error(stderr);
  }
  return stdout;
}

Let me try removing the locale issue and fix this since maybe it can have conflicts with other peoples custom variables since PASSWORD_STORE_DIR is not the only env var used by pass

@camiloaromero23
Copy link
Contributor Author

@capipo pls check the above solution 👆🏽

@camiloaromero23
Copy link
Contributor Author

@pernielsentikaer I think this can be merged

Copy link
Collaborator

@pernielsentikaer pernielsentikaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi 👋

Looks good to me, approved 🔥

@raycastbot raycastbot merged commit d996fb1 into raycast:main Nov 24, 2024
9 checks passed
Copy link
Contributor

Published to the Raycast Store:
https://raycast.com/capipo/pass

@raycastbot
Copy link
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension fix / improvement Label for PRs with extension's fix improvements extension: pass Issues related to the pass extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants