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

Determine process current working directory #51

Closed
giampaolo opened this issue May 23, 2014 · 8 comments
Closed

Determine process current working directory #51

giampaolo opened this issue May 23, 2014 · 8 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on May 12, 2009 17:44:06

Proposal  
for addition of a new Process.cwd property returning the process
current working directory.

Original issue: http://code.google.com/p/psutil/issues/detail?id=51

@giampaolo
Copy link
Owner Author

From [email protected] on May 12, 2009 08:51:04

the process path already provides this information, for cases where we are able to
retrieve the process path: 

        self.path = path
        self.cmdline = cmdline
        # if we have the cmdline but not the path, figure it out from argv[0]
        if cmdline and not path:
            self.path = os.path.dirname(cmdline[0])

Unless you're actually talking about current working directory even if a program is
using chdir() for example. If that's what you're referring to then I'm not sure we
can actually retrieve this information for all platforms.

@giampaolo
Copy link
Owner Author

From [email protected] on May 12, 2009 09:01:25

Yes, I'm referring to your chdir() example, indeed it would probably be better this
be exposed as a method (Process.getcwd()) rather than a property.

I know Linux provides such information through /proc/[PID]/cwd, not sure about OS X
and FreeBSD.
I made a quick research but hadn't much luck so far.

Windows procexp provides this info under the name of "current directory" (left click
on a process -> image -> current directory) and I noticed it varies if process uses
chdir().
As for the BSD search I didn't had much luck here either.

@giampaolo
Copy link
Owner Author

From [email protected] on May 12, 2009 13:22:33

Status: Accepted
Labels: Milestone-0.1.3

@giampaolo
Copy link
Owner Author

From [email protected] on June 10, 2009 07:32:40

Useful links for the Windows implementation: 
http://forum.sysinternals.com/forum_posts.asp?TID=18972&KW 
http://forum.sysinternals.com/forum_posts.asp?TID=14704 http://www.codeproject.com/KB/threads/GetNtProcessInfo.aspx

@giampaolo
Copy link
Owner Author

From [email protected] on June 11, 2009 00:49:45

Implemented for Linux as r407 .

Status: Started
Labels: -Progress-0in4 Progress-1in4

@giampaolo
Copy link
Owner Author

From [email protected] on June 15, 2009 13:43:49

Implemented for Windows in r410 .

Labels: -Progress-1in4 Progress-2in4

@giampaolo
Copy link
Owner Author

From [email protected] on September 17, 2009 01:57:12

As it seems there's no way to determine this on OSX and FreeBSD I'm going to consider
it fixed.

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:49:17

Updated csets after the SVN -> Mercurial migration: r407 == revision 425705f68b0e r410 == revision 7cae8c3bbc17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant