#!/bin/sh

OS=$(uname -s)
PROJ_DIR="$(pwd)"
CHEATNT_DIR="$PROJ_DIR/.cheatnt"

signal_supervisor(){
	procs=($(cat $CHEATNT_DIR/.procs))
	for proc in $procs; do
		echo "sending SIGINT to $proc"
		kill -9 $proc
	done
}

if [[ -e $CHEATNT_DIR ]]; then
	if [[ $OS == "Linux" ]]; then
		sudo chattr +i .
	elif [[ $OS == "Darwin" ]]; then
		signal_supervisor
		echo "removing rw permissions..."
		# sudo chflags -R schg $PROJ_DIR
	elif [[ $OS == "Windows" ]]; then
		echo die trash
	fi
else
	echo "cheatnt wasn't initialized"
fi
