Skip to content

Instantly share code, notes, and snippets.

@ntabee
Last active September 7, 2017 09:56
Show Gist options
  • Save ntabee/5c2e655edce1c59d76d885868031cf5d to your computer and use it in GitHub Desktop.
Save ntabee/5c2e655edce1c59d76d885868031cf5d to your computer and use it in GitHub Desktop.
VSCode invoker for Bash on Ubuntu on Windows
#/bin/sh
# 1. Place wslpath (https://gist.github.com/ntabee/d7af5686dc4a99fda5a77b4ef081b102) in /usr/local/bin (or anywhere path-aware)
# 2. Place this script in "C:\Program Files\Microsoft VS Code Insiders\bin"
# 3. chmod a+x both scripts.
set +x
SCRIPTDIR=`dirname "$0"`
SCRIPTDIR=`wslpath -w -r "${SCRIPTDIR}"`
EXE="${SCRIPTDIR}\\..\\Code - Insiders.exe"
CLI="${SCRIPTDIR}\\..\\resources\\app\\out\\cli.js"
function invoke {
files=()
for f in "$@"; do
fw=`wslpath -w -r "${f}"`
fw="'${fw}'"
files+=(${fw})
done
powershell.exe /c "set-item env:ELECTRON_RUN_AS_NODE -value 1; & '${EXE}' '${CLI}' ${files[@]}"
}
invoke "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment