diff options
-rw-r--r-- | .travis.yml | 3 | ||||
-rwxr-xr-x | cmd2.py | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index 270fe4f7..5deb0667 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: python + sudo: false # false enables container-based build for fast boot times on Linux + matrix: include: - os: linux @@ -37,6 +39,7 @@ matrix: # env: # - TOXENV=py36 # - BREW_INSTALL=python3 + install: - pip install tox # - | @@ -398,8 +398,7 @@ else: # Running on Linux try: with open(os.devnull, 'w') as DEVNULL: - subprocess.check_call('xclip -o -sel clip', shell=True, stdin=subprocess.PIPE, stdout=DEVNULL, - stderr=DEVNULL) + subprocess.check_call(['uptime', '|', 'xclip'], stdout=DEVNULL, stderr=DEVNULL) can_clip = True except (subprocess.CalledProcessError, OSError, IOError): pass # something went wrong with xclip and we cannot use it @@ -409,8 +408,7 @@ else: :return: str - contents of the clipboard """ - xclipproc = subprocess.Popen('xclip -o -sel clip', shell=True, stdout=subprocess.PIPE, - stdin=subprocess.PIPE) + xclipproc = subprocess.Popen(['xclip', '-o', '-selection', 'clipboard'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) stdout, stderr = xclipproc.communicate() if six.PY3: return stdout.decode() @@ -422,7 +420,7 @@ else: :param txt: str - text to paste to the clipboard """ - xclipproc = subprocess.Popen('xclip -sel clip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) + xclipproc = subprocess.Popen(['xclip', '-selection', 'clipboard'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) if six.PY3: xclipproc.stdin.write(txt.encode()) else: @@ -430,7 +428,7 @@ else: xclipproc.stdin.close() # but we want it in both the "primary" and "mouse" clipboards - xclipproc = subprocess.Popen('xclip', shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE) + xclipproc = subprocess.Popen(['xclip'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) if six.PY3: xclipproc.stdin.write(txt.encode()) else: |