{"action":"opened","issue":{"url":"https://api.github.com/repos/dart-lang/sdk/issues/28160","repository_url":"https://api.github.com/repos/dart-lang/sdk","labels_url":"https://api.github.com/repos/dart-lang/sdk/issues/28160/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/sdk/issues/28160/comments","events_url":"https://api.github.com/repos/dart-lang/sdk/issues/28160/events","html_url":"https://github.com/dart-lang/sdk/issues/28160","id":196804701,"number":28160,"title":"Allow environment variables to be set within a process","user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"labels":[{"id":219928184,"url":"https://api.github.com/repos/dart-lang/sdk/labels/area-library","name":"area-library","color":"c7def8","default":false},{"id":219928199,"url":"https://api.github.com/repos/dart-lang/sdk/labels/library-io","name":"library-io","color":"d4c5f9","default":false},{"id":334529267,"url":"https://api.github.com/repos/dart-lang/sdk/labels/Type:%20enhancement","name":"Type: enhancement","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-20T23:08:16Z","updated_at":"2016-12-20T23:08:16Z","closed_at":null,"body":"**To clarify**: In this issue I'm referring to the OS's notion of environment variables, not the thing you pass in to a Dart process via `-D`.\r\n\r\nCurrently Dart has no means of modifying the set of environment variables within a process. This turns out to be important for integrating the `test` package with the Bolt interactive runner. Specifically, we need a way of setting environment variables within a specific section of the program. My ideal API for this would be:\r\n\r\n```\r\nT withEnvironment<T>(T callback(), Map<String, String> newValues);\r\n```\r\n\r\nwhere `callback()` runs in a zone such that:\r\n\r\n* `Platform.environment` returns values from `newValues` merged with the previous values,\r\n* spawned processes use the new `Platform.environment` as the default environment, and\r\n* spawned isolates use the new `Platform.environment` as the default environment.\r\n\r\nI could live with an API that only sets these variables on Isolate boundaries, though, such as a `Map<String, String> osEnvironment` argument to `Isolate.spawnUri()` that has no effect on non-VM platforms."}}
{"actor":{"display_login":"nex3"}}