-
-
Save mslinn/db41c6b58b750855bc4e7718bf8acf28 to your computer and use it in GitHub Desktop.
WSL launch script for IntelliJ IDEA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
idea2 "$@" & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unset SBT_OPTS | |
export IDEA_HOME=/opt/idea-IU-192.6262.58 # TODO modify this path to the IDEA installation location | |
cd "$IDEA_HOME/bin" | |
export LIBXCB_ALLOW_SLOPPY_LOCK=1 | |
PID_FILE=/var/run/idea.pid | |
if [ -f "$PID_FILE" ]; then | |
PID="$(cat $PID_FILE)" | |
if [ "$PID" != "" ]; then | |
echo "Killing process in $PID_FILE (pid $PID)" | |
sudo kill -9 "$PID" | |
fi | |
sudo rm $PID_FILE | |
fi | |
PROCS="$(ps aux | grep [i]dea | grep java)" | |
while read -r PSOUT; do | |
PID="$(echo "$PSOUT" | cut -d' ' -f5)" | |
NAME="$(echo "$PSOUT" | cut -d' ' -f18)" | |
if [ "$PID" ]; then | |
echo "Killing $NAME (pid $PID)" | |
sudo kill -9 $PID | |
fi | |
done <<< "$PROCS" | |
echo $! | sudo tee $PID_FILE | |
./idea.sh "$@" &> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment