mirror of
https://github.com/churchers/vm-bhyve.git
synced 2025-12-15 21:23:52 +01:00
Fix exit status for many vm commands
The pattern "[ $? -ne 0 ] && util::err ..." is problematic since it leaves an exit status of 1 if the test fails, which is the non-error case. So various commands (e.g., vm datastore add) return status 1 even when they succeed if this pattern appears as the last line of a command implementation. Fix this by mechanically converting this pattern to "[ $? -eq 0 ] || util:err ...".
This commit is contained in:
@@ -44,7 +44,7 @@ util::load_module(){
|
||||
kldstat -qm ${_mod} >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
kldload ${_mod} >/dev/null 2>&1
|
||||
[ $? -ne 0 ] && util::err "unable to load ${_mod}.ko!"
|
||||
[ $? -eq 0 ] || util::err "unable to load ${_mod}.ko!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user