-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
Foundation/Process.swift
Outdated
} | ||
|
||
// posix_spawn doesn't support passing a custom working directory, so resort to chdir. | ||
return chdir(rawPath) == 0 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@parkera please review the revised commit. |
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`).
@parkera: Done! Please re-review the latest commit. |
@swift-ci please test |
@parkera Good to go? |
Yes, thanks for taking this one on! |
@swift-ci test and merge |
This patch adds support for the
currentDirectoryPath
property onProcess
Since
posix_spawn
doesn't make it easy to change the working directory, acall to
chdir
is issued just before the process executes. It looks likelldb
follows a similar pattern in one of its tools(
tools/darwin-debug/darwin-debug.cpp
).This also addresses SR-3524