Skip to content

Add support for currentDirectoryPath in Process class #1008

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

Merged
merged 1 commit into from
Jul 25, 2017
Merged

Add support for currentDirectoryPath in Process class #1008

merged 1 commit into from
Jul 25, 2017

Conversation

mattrajca
Copy link
Contributor

This patch adds support for the currentDirectoryPath property on Process

Since posix_spawn doesn't make it easy to change the working directory, a
call to chdir is issued just before the process executes. It looks like
lldb follows a similar pattern in one of its tools
(tools/darwin-debug/darwin-debug.cpp).

This also addresses SR-3524

@mattrajca mattrajca changed the title Add support for currentDirectoryPath in Process class. Add support for currentDirectoryPath in Process class May 24, 2017
}

// posix_spawn doesn't support passing a custom working directory, so resort to chdir.
return chdir(rawPath) == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something, or don't we have to reset this value after we're done with the launch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parkera Good catch, I updated the commit.

@mattrajca
Copy link
Contributor Author

@parkera please review the revised commit.

@parkera
Copy link
Contributor

parkera commented Jul 18, 2017

Looks good, thanks. Can you just do one more thing for me and add a couple lines to the test to 1. get the CWD before/after and comparing, to verify that we did that correctly too.

This patch adds support for the `currentDirectoryPath` property on `Process`

Since `posix_spawn` doesn't make it easy to change the working directory, a
call to `chdir` is issued just before the process executes. It looks like
`lldb` follows a similar pattern in one of its tools
(`tools/darwin-debug/darwin-debug.cpp`).
@mattrajca
Copy link
Contributor Author

@parkera: Done! Please re-review the latest commit.

@alblue
Copy link
Contributor

alblue commented Jul 20, 2017

@swift-ci please test

@mattrajca
Copy link
Contributor Author

@parkera Good to go?

@parkera
Copy link
Contributor

parkera commented Jul 25, 2017

Yes, thanks for taking this one on!

@parkera
Copy link
Contributor

parkera commented Jul 25, 2017

@swift-ci test and merge

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.

4 participants