Backport multi-version Powershell fix

Former-commit-id: 7e82515f1146e2551eb887cf2513fa7e7f6fc082
Former-commit-id: 827531aca1be7bfe18cfb194e5ce9fcb124099b8
This commit is contained in:
2023-06-08 15:48:43 -04:00
parent 59d0844d77
commit d32bd72d68
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -740,7 +740,7 @@ def copy_data():
# WSL clipboard detection
if 'WSL_DISTRO_NAME' in environ:
run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"])
Popen("sleep 30; pwsh.exe -c 'echo \"\" | Set-Clipboard'", shell=True)
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL))
# Wayland clipboard detection
elif 'WAYLAND_DISPLAY' in environ:
run(['wl-copy', _copy_line[_index].rstrip()])
+1 -1
View File
@@ -9,7 +9,7 @@ arguments = argv[1:]
if len(arguments) > 0:
if arguments[0] == 'WSL':
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"])
Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)"""
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DENVULL)"""
elif arguments[0] == 'MAC':
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],
stdout=PIPE).stdout)