Public bug reported:

I previously reported this bug on Github
(https://github.com/lxc/lxc/issues/1137), but am duplicating the report
here for completeness.

I've found that my python scripts stop responding to keyboard input
after running an lxc attach_wait command in python3-lxc
(2.0.4-0ubuntu2).

I wrote a small script to quickly reproduce the issue. With the script,
one can see that using Ctrl+C before running the lxc command causes a
KeyboardInterrupt, but using Ctrl+C after the lxc command finishes is no
longer caught.

    #!/usr/bin/env python3

    import lxc
    import time
    import os
    
    CONTAINER_NAME='xenial'
    CONTAINER_PATH='%s/.cache/libertine-container' % os.environ["HOME"]
    
    def lxc_work():
        container = lxc.Container(CONTAINER_NAME, CONTAINER_PATH)
        container.start()
        container.attach_wait(lxc.attach_run_command, ['ls'])
    
    print("Ctrl+C will attempt to stop the script during the next ~5 seconds")
    time.sleep(5)
    
    print("Running lxc command 'ls' in container '%s', please wait..." % 
CONTAINER_NAME)
    lxc_work()
    
    print("Ctrl+C should attempt to stop the script in the next ~5 seconds, but 
doesn't")
    time.sleep(5)

Also see:
https://gist.github.com/larryprice/f562f838ff84929c1619978a6404b8b6

** Affects: lxc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1614232

Title:
  python-lxc attach_wait prevents further keyboard input

Status in lxc package in Ubuntu:
  New

Bug description:
  I previously reported this bug on Github
  (https://github.com/lxc/lxc/issues/1137), but am duplicating the
  report here for completeness.

  I've found that my python scripts stop responding to keyboard input
  after running an lxc attach_wait command in python3-lxc
  (2.0.4-0ubuntu2).

  I wrote a small script to quickly reproduce the issue. With the
  script, one can see that using Ctrl+C before running the lxc command
  causes a KeyboardInterrupt, but using Ctrl+C after the lxc command
  finishes is no longer caught.

      #!/usr/bin/env python3

      import lxc
      import time
      import os
      
      CONTAINER_NAME='xenial'
      CONTAINER_PATH='%s/.cache/libertine-container' % os.environ["HOME"]
      
      def lxc_work():
          container = lxc.Container(CONTAINER_NAME, CONTAINER_PATH)
          container.start()
          container.attach_wait(lxc.attach_run_command, ['ls'])
      
      print("Ctrl+C will attempt to stop the script during the next ~5 seconds")
      time.sleep(5)
      
      print("Running lxc command 'ls' in container '%s', please wait..." % 
CONTAINER_NAME)
      lxc_work()
      
      print("Ctrl+C should attempt to stop the script in the next ~5 seconds, 
but doesn't")
      time.sleep(5)

  Also see:
  https://gist.github.com/larryprice/f562f838ff84929c1619978a6404b8b6

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1614232/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to