Skip to content

fix active terminal cwd finder logic#6042

Open
KMohZaid wants to merge 1 commit into
basecamp:devfrom
KMohZaid:dev
Open

fix active terminal cwd finder logic#6042
KMohZaid wants to merge 1 commit into
basecamp:devfrom
KMohZaid:dev

Conversation

@KMohZaid

@KMohZaid KMohZaid commented Jun 6, 2026

Copy link
Copy Markdown

Before it was just assuming last spawn is our cwd but it's not always true

for example the scenario is like this

❯ pgrep -P "$terminal_id"
1884112
1884114
1884120

Looking in full details

              
omarchy dev 
❯ pgrep -P "$terminal_id" | xargs ps -fp
UID          PID    PPID  C STIME TTY      STAT   TIME CMD
user    1884112 1883788  0 17:41 ?        Sl     0:00 /usr/bin/kitten __atexit__
user    1884114 1883788  0 17:41 pts/1    Ss     0:06 /usr/bin/fish
user    1884120 1883788  0 17:41 ?        Sl     0:00 /usr/bin/kitten __watch_con

Old script was taking last pid, but there is chance last pid is not our shell.

This PR just change one line to filter out non interactive processes and select last process pid ( in case of multiple shell terminal)

Before it was just assuming last spawn is our cwd but it's not always
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant