#!/usr/bin/env bash

set -e

_dir="$(dirname "${BASH_SOURCE[0]}")"

to_run="${@:-thread http}"

if [[ $to_run == *"thread"* ]]; then
	"${_dir}"/thread
fi

if [[ $to_run == *"http"* ]]; then
	"${_dir}"/http --daemon
	sleep 2
	"${_dir}"/client 8001
	pkill -f 'wsgi:app'
fi
