Skip to content
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

Add argument to keep environment variables #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sandwine/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ def parse_command_line(args):
help='on non-zero exit code run PROGRAM a second time'
'; helps to workaround weird graphics-related crashes'
' (default: run command once)')
general.add_argument('--keep-env',
dest='keep_env',
action='store_true',
help='keep host env (default: keep-env disabled)')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--- help='keep host env (default: keep-env disabled)')
+++ help='keep host environment variables (CAREFUL!) (default: start with an empty environment)')


return parser.parse_args(args)

Expand Down Expand Up @@ -388,7 +392,8 @@ def create_bwrap_argv(config):
env_tasks['PATH'] = os.pathsep.join(available_paths)

# Create environment (meaning environment variables)
argv.add('--clearenv')
if not config.keep_env:
argv.add('--clearenv')
for env_var, env_value in sorted(env_tasks.items(), key=itemgetter(0)):
if env_value is None:
env_value = os.environ.get(env_var)
Expand Down