hypercwd icon indicating copy to clipboard operation
hypercwd copied to clipboard

Sometimes new tab points to /

Open krzkaczor opened this issue 8 years ago • 8 comments

Sometimes when there is a long running process on current tab (for example watcher) new tabs opens to / instead of current directory.

lsof -p PID | grep cwd | tr -s ' ' | cut -d ' ' -f9- actually returns / Maybe we need different way of tracking CWD?

krzkaczor avatar Aug 04 '16 15:08 krzkaczor

Presumably this is the same problem as #5.

lsof -p PID | grep cwd | tr -s ' ' | cut -d ' ' -f9- actually returns / Maybe we need different way of tracking CWD?

What's wrong with pwd?

rhys-vdw avatar Aug 16 '16 23:08 rhys-vdw

It's returning / for that PID so it's obviously not perfect. I didn't dive into internals of hyperterm yet but it would make sense for me that hyperterm tracks CWD of each tab.

krzkaczor avatar Aug 17 '16 08:08 krzkaczor

Basically the way this works is it watches for new STDOUT or STDERR output or tabs and get's the cwd from the process. So if you have a process (watcher is one that does this I think) that changes it's directory while running and then spits out some output on STDOUT or STDERR it will cause new tabs to open to that directory.

Proof this isn't perfect, not sure how to fix this at the moment though 😬

hharnisc avatar Aug 18 '16 13:08 hharnisc

I've the same issue. Whenever a process is running and I open a new tab I'm redirected to / instead of the current directory.

vinkla avatar Sep 15 '16 14:09 vinkla

Same here. Ironically, it is during a long-running process that I am most likely to need to open a new tab.

deitch avatar Dec 08 '16 20:12 deitch

Sorry to beat a dead horse, but this doesn't work for me either.

I've run 'lsof -p PID | grep cwd | tr -s ' ' | cut -d ' ' -f9-' against the proper PID which produces:

--> /

When in fact the current tab is my home dir not root.

jzevin avatar Jan 09 '17 19:01 jzevin

Can you elaborate why pwd isn't sufficient?

I have a home directory that includes a symlink, and the lsof approach unrolls that symlink to its effective location, so newly opened tabs will take me there as opposed to the symlinked path I came from.

fwenzel avatar Jan 11 '17 18:01 fwenzel

Probably insignificant, but should also either add lsof as a package requirement/dependency (at least in the readme/docs), or use another method to get cwd. I didn't have it installed and this plugin wasn't working for me until I debugged it.

kapace avatar Jun 06 '18 16:06 kapace