From 407fe8dfac7a87a86086af350f84fec3e78f0c73 Mon Sep 17 00:00:00 2001 From: Derek Date: Mon, 9 Nov 2026 20:06:30 +1100 Subject: [PATCH] fix(developer): stop adding a second fnm init to shell rc The fnm shell-init tasks matched only an eval at the start of a line. An rc with the init indented inside an if-block got a second copy. That ran fnm twice per shell and printed "Using Node" twice in a pinned directory. The match now allows leading whitespace and replaces the existing line in place. --- ansible/roles/developer/tasks/nodejs.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ansible/roles/developer/tasks/nodejs.yml b/ansible/roles/developer/tasks/nodejs.yml index 1e225e32..38ff75ce 100644 --- a/ansible/roles/developer/tasks/nodejs.yml +++ b/ansible/roles/developer/tasks/nodejs.yml @@ -211,7 +211,8 @@ - name: Wire fnm into the shell (Linux) ansible.builtin.lineinfile: path: "{{ user_home }}/.bashrc" - regexp: '^eval "\$\(fnm env' + # Leading whitespace too, so a hand-written init inside an if-block counts. + regexp: '^\s*eval "\$\(fnm env' line: 'eval "$(fnm env --use-on-cd)"' state: present owner: "{{ actual_user }}" @@ -264,7 +265,8 @@ - name: Wire fnm into the shell (macOS) ansible.builtin.lineinfile: path: "{{ user_home }}/.zshrc" - regexp: '^eval "\$\(fnm env' + # Leading whitespace too, so a hand-written init inside an if-block counts. + regexp: '^\s*eval "\$\(fnm env' line: 'eval "$(fnm env --use-on-cd)"' state: present mode: '0644'