Skip to content

Commit

Permalink
Make cli atom --wait work on Cygwin
Browse files Browse the repository at this point in the history
  • Loading branch information
damieng committed Mar 7, 2016
1 parent 8472f91 commit 56b23a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions atom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ if [ "$(uname)" == 'Darwin' ]; then
OS='Mac'
elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
OS='Linux'
elif [ "$(expr substr $(uname -s) 1 10)" == 'MINGW32_NT' ]; then
OS='Cygwin'
else
echo "Your platform ($(uname -a)) is not supported."
exit 1
Expand Down
19 changes: 8 additions & 11 deletions resources/win/atom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ while getopts ":fhtvw-:" opt; do
case "${OPTARG}" in
wait)
WAIT=1
EXPECT_OUTPUT=1
;;
help|version)
REDIRECT_STDERR=1
Expand All @@ -18,6 +19,7 @@ while getopts ":fhtvw-:" opt; do
;;
w)
WAIT=1
EXPECT_OUTPUT=1
;;
h|v)
REDIRECT_STDERR=1
Expand All @@ -31,19 +33,14 @@ done

directory=$(dirname "$0")

WINPS=`ps | grep -i $$`
PID=`echo $WINPS | cut -d' ' -f 4`

if [ $EXPECT_OUTPUT ]; then
export ELECTRON_ENABLE_LOGGING=1
"$directory/../../atom.exe" --executed-from="$(pwd)" --pid=$PID "$@"
if [ $WAIT == 'YES' ]; then
powershell -noexit "%~dp0\..\..\atom.exe" --pid=$pid "$@" ;
wait-event
else
"$directory/../../atom.exe" "$@"
fi
else
"$directory/../app/apm/bin/node.exe" "$directory/atom.js" "$@"
fi

# If the wait flag is set, don't exit this process until Atom tells it to.
if [ $WAIT ]; then
while true; do
sleep 1
done
fi

0 comments on commit 56b23a4

Please sign in to comment.