Expand ~ and env vars in program names. Fixes #483

This commit is contained in:
Kovid Goyal
2018-04-23 10:53:20 +05:30
parent 92ca8ab9cc
commit edc4b91d15
4 changed files with 19 additions and 9 deletions
+4 -4
View File
@@ -8,7 +8,6 @@ import fcntl
import math
import os
import re
import shlex
import socket
import string
import subprocess
@@ -111,10 +110,11 @@ def base64_encode(
def command_for_open(program='default'):
if program == 'default':
if isinstance(program, str):
from .config_utils import to_cmdline
program = to_cmdline(program)
if program == ['default']:
cmd = ['open'] if is_macos else ['xdg-open']
else:
cmd = shlex.split(program)
return cmd