-
Notifications
You must be signed in to change notification settings - Fork 35
Update ProcessExecutor to support environment variables #232
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
| if let environment { | ||
| process.environment = environment | ||
| } |
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.
[nits] It's enough to be
| if let environment { | |
| process.environment = environment | |
| } | |
| process.environment = environment |
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.
I don't think so. Setting the property explicitly to nil will not mean ineheriting the current process environment, rather it may clear out the environment. We should be careful about this behavior.
If this method isn’t used, the environment is inherited from the process that created the receiver.
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.
I checked the implementation in swift-corelibs-foundation. If the property is nil ProcessInfo.processInfo.environment is used, so setting nil explicitly will be safe.
However, I still prefer not to set the property if it's not needed.
I added an environment parameter to ProcessExecutor to support executing processes with custom environment variables.
This change enables use of ScipioKit in custom build pipelines that require specific environment configurations.