NSGetEnviron and PR#400


(Yannick Heinrich) #1

Hello,

I initiated the PR #400 in the package manager and I’m trying to implement
the last suggestion in this thread.

This is to recopy the current environment variables for git clone instead
of cherry-pick several specifics one.

I would like to use the _NSGetEnviron variable that should be defined in
Darwin but I don’t manage to reference it.

I tried:

return environ

return Darwin.environ

return libc.environ

I’m using the DEVELOPMENT-SNAPSHOT-2016-05-09-a toolchain.

Any tips on how to call this method from Swift ?

Regards

Yannick


(Ankit Agarwal) #2

Hi,

There is no native method in swift to get the environment list right now
but you can use Foundation's NSProcessInfo
If you want an example:
https://github.com/apple/swift-package-manager/blob/master/Sources/Commands/SwiftTestTool.swift#L188

Thanks

···

On Fri, Jun 10, 2016 at 2:49 PM, Yannick Heinrich via swift-build-dev < swift-build-dev@swift.org> wrote:

Hello,

I initiated the PR #400 in the package manager and I’m trying to implement
the last suggestion in this thread.

This is to recopy the current environment variables for git clone instead
of cherry-pick several specifics one.

I would like to use the _NSGetEnviron variable that should be defined in
Darwin but I don’t manage to reference it.

I tried:

return environ

return Darwin.environ

return libc.environ

I’m using the DEVELOPMENT-SNAPSHOT-2016-05-09-a toolchain.

Any tips on how to call this method from Swift ?

Regards

Yannick

_______________________________________________
swift-build-dev mailing list
swift-build-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-build-dev

--
Ankit