raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.41k stars 3.1k forks source link

fix: remove process.env from pass execution #15462

Open camiloaromero23 opened 1 day ago

camiloaromero23 commented 1 day ago

Description

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 commented 1 day ago

Thank you for your first contribution! :tada:

🔔 @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 commented 22 hours ago

Could you check this @capipo

capipo commented 7 hours ago

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 commented 7 hours ago

Nevermind, I see that that variable is passed later

camiloaromero23 commented 7 hours ago

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 commented 7 hours ago

@capipo pls check the above solution 👆🏽