instance.py

changeset 29
9dd2e5d57a7c
parent 24
94d58d514d69
child 31
b4b4bb7a2ec5
--- a/instance.py	Sun Jan 21 11:59:53 2018 +0000
+++ b/instance.py	Sun Jan 21 12:04:24 2018 +0000
@@ -41,20 +41,19 @@
 
         logging.info('Launching ' + str(cmd))
 
-        env=None
+        env=os.environ.copy()
         if passphrase:
-            env=os.environ.copy()
             env['BORG_PASSPHRASE']=passphrase
 
         # Workaround: if launched is a standalone app created with py2app,
         # borg will fail unless Python environment is reset.
         # TODO: Of course, this will fail if the system needs the variables
         # PYTHONPATH or PYTHONHOME set to certain values.
-        if '_PY2APP_LAUNCHED_' in env and env['_PY2APP_LAUNCHED_']=='1':
-            if env==None:
-                env=os.environ.copy()
-            del env['PYTHONPATH']
-            del env['PYTHONHOME']
+        if '_PY2APP_LAUNCHED_' in env:
+            val=env['_PY2APP_LAUNCHED_']
+            if val=='1':
+                del env['PYTHONPATH']
+                del env['PYTHONHOME']
 
         self.proc=Popen(cmd, env=env, stdout=PIPE, stderr=PIPE, stdin=PIPE)
 

mercurial