summaryrefslogtreecommitdiff
path: root/lib/functions.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2018-04-24 23:47:26 +0200
committerGitHub <noreply@github.com>2018-04-24 23:47:26 +0200
commit93d9431890540dfdc1021dffca3eeebdc19d338d (patch)
tree0aab77d7310f6da2cfd56e6000db471b0fd97d6d /lib/functions.zsh
parentef70990ce1ac0239005b267e5dcfe096969d26c3 (diff)
downloadzsh-93d9431890540dfdc1021dffca3eeebdc19d338d.tar.gz
zsh-93d9431890540dfdc1021dffca3eeebdc19d338d.tar.bz2
zsh-93d9431890540dfdc1021dffca3eeebdc19d338d.zip
Check for Microsoft's WSL in open_command (#6751)
This will work only on files and directories in a DrvFs mount, i.e. that can be translated to a Windows drive path. For example: /mnt/c/Users/user. Files and folders inside the LXSS directory can't be handled in Windows, they must be ONLY used by the WSL subsystem. That's why you won't be able to open your $HOME directory, for instance. See https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/
Diffstat (limited to 'lib/functions.zsh')
-rw-r--r--lib/functions.zsh4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index f30653784..7410ae645 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -25,7 +25,9 @@ function open_command() {
case "$OSTYPE" in
darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;;
- linux*) open_cmd='xdg-open' ;;
+ linux*) [[ $(uname -a) =~ "Microsoft" ]] && \
+ open_cmd='cmd.exe /c start' || \
+ open_cmd='xdg-open' ;;
msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported"
return 1