Skip to content

Commit

Permalink
Fix bug with python processes left behind. Fix bug with unset PYTHONP…
Browse files Browse the repository at this point in the history
…ATH.
  • Loading branch information
philipbergen committed Sep 29, 2013
1 parent bb6dc3d commit 790c1d6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,25 @@ install_bins () {
cat > zero <<EOF
#!/bin/bash
. $here/env.sh
python -m \$(basename \$0) "\$@"
trap ctrl_c EXIT
function ctrl_c() {
set +eu
for pid in "\${pids[@]}"; do
kill -0 \$pid 2>/dev/null 1>/dev/null || {
continue
}
kill \$pid
done
}
pids=()
function add_pid() {
pids=( \$1 \${pids[@]} )
}
python -m \$(basename \$0) "\$@"&
add_pid \$!
wait
EOF
chmod a+x zero
for exe in zlog zlog-sink; do
Expand All @@ -85,7 +103,7 @@ create_env () {
PYPKG=$(dirname $(pip show pyzmq|grep Location |cut -d' ' -f2))
echo "*** INFO: Creating env.sh."
cat > env.sh <<EOF
export PYTHONPATH="$here/py:$here/bin:$here:\$PYTHONPATH"
export PYTHONPATH="$here/py:$here/bin:$here:\${PYTHONPATH:-}"
export PATH="/usr/local/share/python:\$HOME/Library/Python/2.7/bin:$here/bin:\$PATH"
[ $(uname) = Darwin ] && launchctl limit maxfiles 16384
Expand Down

0 comments on commit 790c1d6

Please sign in to comment.