diff --git a/lib/sshyp.py b/lib/sshyp.py index b6f2c79..71fed87 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -735,7 +735,7 @@ def copy_data(): # PORT START CLIPBOARD # WSL clipboard detection if 'WSL_DISTRO_NAME' in environ: - run(['pwsh.exe', '-c', 'Set-Clipboard', _copy_line[_index].rstrip()]) + run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"]) Popen("sleep 30; pwsh.exe -c 'echo \"\" | Set-Clipboard'", shell=True) # Wayland clipboard detection elif 'WAYLAND_DISPLAY' in environ: diff --git a/port-jobs/CLIPBOARD.py b/port-jobs/CLIPBOARD.py index 7442f10..f62be0a 100755 --- a/port-jobs/CLIPBOARD.py +++ b/port-jobs/CLIPBOARD.py @@ -8,18 +8,18 @@ arguments = argv[1:] # define replacement text depending on arguments if len(arguments) > 0: if arguments[0] == 'WSL': - replacement = """run(['pwsh.exe', '-c', 'Set-Clipboard', _copy_line[_index].rstrip()]) - Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)""" + replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"]) + Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)""" elif arguments[0] == 'MAC': replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout) - Popen("sleep 30; printf '' | pbcopy", shell=True)""" + Popen("sleep 30; printf '' | pbcopy", shell=True)""" elif arguments[0] == 'HAIKU': replacement = """run(['clipboard', '-c', _copy_line[_index].rstrip()]) - Popen('sleep 30; clipboard -r', shell=True)""" + Popen('sleep 30; clipboard -r', shell=True)""" elif arguments[0] == 'TERMUX': replacement = """run(['termux-clipboard-set', _copy_line[_index].rstrip()]) - Popen("sleep 30; termux-clipboard-set ''", shell=True)""" + Popen("sleep 30; termux-clipboard-set ''", shell=True)""" elif arguments[0] == 'BSD': replacement = """run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\', '\\\\') .replace('%', '%%')], stdout=PIPE).stdout)