~larryprice/libertine/lxd

« back to all changes in this revision

Viewing changes to python/libertine/LxdContainer.py

  • Committer: Larry Price
  • Date: 2016-12-12 19:56:19 UTC
  • Revision ID: larry.price@canonical.com-20161212195619-27iod96zxa09fl5x
fix terminal getting eaten

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2106 Canonical Ltd.
 
1
# Copyright 2016 Canonical Ltd.
2
2
#
3
3
# This program is free software: you can redistribute it and/or modify it
4
4
# under the terms of the GNU General Public License version 3, as published
28
28
        '/dev/tty7':   {'path': '/dev/tty7', 'type': 'unix-char'},
29
29
        '/dev/tty8':   {'path': '/dev/tty8', 'type': 'unix-char'},
30
30
        '/dev/fb0':    {'path': '/dev/fb0', 'type': 'unix-char'},
31
 
        'x11-socket':  {'source': '/tmp/.X11-unix', 'path': '/tmp/.X11-unix', 'type': 'disk'}
 
31
        'x11-socket':  {'source': '/tmp/.X11-unix', 'path': '/tmp/.X11-unix', 'type': 'disk', 'optional': 'true'},
32
32
    }
33
33
 
34
34
    if os.path.exists('/dev/video0'):
241
241
                'path': os.path.join(home_path, '.config', 'dconf')
242
242
            }
243
243
 
 
244
        run_user = '/run/user/{}'.format(os.getuid())
 
245
        self._container.devices[run_user] = {'source': run_user, 'path': run_user, 'type': 'disk'}
 
246
 
244
247
        mounts = utils.get_common_xdg_user_directories() + \
245
248
                 self._config.get_container_bind_mounts(self._id)
246
249
        for user_dir in utils.generate_binding_directories(mounts, home_path):
265
268
            utils.get_logger().error("Could not get container '{}'".format(self._id))
266
269
            return None
267
270
 
 
271
        self._update_libertine_profile()
268
272
        self._update_bind_mounts()
269
273
        self.start_container()
270
274
 
277
281
        self._window_manager = psutil.Popen(wm_args)
278
282
 
279
283
        args.extend(app_exec_line)
280
 
 
281
284
        return psutil.Popen(args)
282
285
 
283
286
    def finish_application(self, app):
284
 
        os.waitpid(app.pid, 0)
285
287
        utils.terminate_window_manager(self._window_manager)
 
288
        os.waitpid(app.pid, os.WNOHANG)
286
289
 
287
290
    def copy_file_to_container(self, source, dest):
288
291
        with open(source, 'rb') as f: