~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to scripts/python-console

  • Committer: dcoles
  • Date: 2008-08-04 00:19:18 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:974
Console: Sanitise Environment varibles. We now only give PATH and HOME (and 
drop the rest)

Show diffs side-by-side

added added

removed removed

Lines of Context:
324
324
if __name__ == "__main__":
325
325
    port = int(sys.argv[1])
326
326
    magic = sys.argv[2]
 
327
    
 
328
    # Sanitise the Enviroment
 
329
    os.environ = {}
 
330
    os.environ['PATH'] = '/usr/local/bin:/usr/bin:/bin'
 
331
 
327
332
    if len(sys.argv) >= 4:
328
333
        # working_dir
329
334
        os.chdir(sys.argv[3])
330
 
        # Make python's search path follow the cwd
331
 
        sys.path[0] = ''
332
335
        os.environ['HOME'] = sys.argv[3]
333
336
 
 
337
    # Make python's search path follow the cwd
 
338
    sys.path[0] = ''
 
339
 
334
340
    common.chat.start_server(port, magic, True, dispatch_msg, initializer)