-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For cross-platform build take the linux version of printenv.py
- Loading branch information
Dmitry Trofimov
committed
Sep 29, 2016
1 parent
ffb30fb
commit 92ea85e
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python | ||
|
||
# Dumps environment variables into specified file. | ||
# Format: zero-separated "name=value" pairs in platform encoding. | ||
|
||
import os | ||
import sys | ||
|
||
if len(sys.argv) != 2: | ||
raise Exception('Exactly one argument expected') | ||
|
||
f = open(sys.argv[1], 'wb') | ||
try: | ||
for key, value in os.environ.items(): | ||
s = '%s=%s\0' % (key, value) | ||
f.write(s.encode('utf-8')) | ||
finally: | ||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters