Skip to content
Merged
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
35 changes: 23 additions & 12 deletions launch/framework.bash
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
#!/bin/bash
# this script launches the ER-force framework and our simulator UI simultaneously and allows you to kill both at once using ctrl-c
# you may need to press ctrl-c twice
echo "launching ER-Force framework and our UI"
# kill existing ER-Force simulator instances
pkill .*simulator-cli
# in a subshell:
# first trap SIGINT to kill the entire subshell
# then find the location of simulator-cli in the home directory and run it with args -g 2020B (in background)
# then run sim through makefile shortcut (in background)
# finally wait, so that the simulator-cli process isn't lost/disowned when run-our-stack dies before it does.
(trap 'exit' SIGINT SIGTERM; trap 'kill 0' EXIT; find ~ -name 'simulator-cli' -type f -exec '{}' -g 2020B ';' & make run-our-stack & wait)
pkill .*simulator-cli

# Find the binary named simulator-cli somewhere inside the home directory
binary=$(find ~ -type f -name "simulator-cli" -print -quit)

# Check if the binary was found
if [ -z "$binary" ]; then
echo "Binary 'simulator-cli' not found."
exit 1
fi

# Run the binary in the background
"$binary" &
binary_pid=$!

# Run "make run-our-stack" in the foreground
make run-our-stack

# Ensure that pressing Ctrl+C kills all subprocesses
trap 'kill $binary_pid; exit' INT

# Wait for the background process to complete
wait $binary_pid

Loading