Enhance the check before running an instance
This commit is contained in:
parent
7c4c5dd7e5
commit
7c07457d1e
@ -95,6 +95,13 @@ check_has_built() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_has_run() {
|
||||||
|
if pgrep --full "$instance_dir/build/bin/occlum-run" > /dev/null ; then
|
||||||
|
echo "Error: the process of current Occlum instance is running. Need to wait for the process to finish or kill it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cmd_new() {
|
cmd_new() {
|
||||||
if [ -z $@ ]; then
|
if [ -z $@ ]; then
|
||||||
echo "Error: target directory is not set"
|
echo "Error: target directory is not set"
|
||||||
@ -246,6 +253,7 @@ cmd_build() {
|
|||||||
|
|
||||||
cmd_run() {
|
cmd_run() {
|
||||||
check_has_built
|
check_has_built
|
||||||
|
check_has_run
|
||||||
|
|
||||||
SGX_MODE=$(cat $instance_dir/.sgx_mode)
|
SGX_MODE=$(cat $instance_dir/.sgx_mode)
|
||||||
if [[ -n $SGX_MODE && "$SGX_MODE" != "HW" ]]; then
|
if [[ -n $SGX_MODE && "$SGX_MODE" != "HW" ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user