Skip to content

Instantly share code, notes, and snippets.

@Jessidhia
Created June 30, 2016 05:27
Show Gist options
  • Save Jessidhia/fb8374fc05500727b725214d6167de66 to your computer and use it in GitHub Desktop.
Save Jessidhia/fb8374fc05500727b725214d6167de66 to your computer and use it in GitHub Desktop.
VS Code's launch script modified to work when called from inside Cygwin
#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
NAME="Code"
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
ELECTRON="$VSCODE_PATH/$NAME.exe"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
if [ "$OSTYPE" = "cygwin" ] && which cygpath &>/dev/null; then
# $ELECTRON expects windows paths for everything
CLI="$(cygpath -w "$CLI")"
declare -a ARGS
for arg in "$@"; do
if [ -e "$arg" ]; then
ARGS=("${ARGS[@]}" "$(cygpath -w "$arg")")
else
ARGS=("${ARGS[@]}" "$arg")
fi
done
else
ARGS=$@
fi
ELECTRON_NO_ATTACH_CONSOLE=1 ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "${ARGS[@]}"
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment