mirror of
https://github.com/appium/appium.git
synced 2026-10-25 02:00:57 +08:00
15 lines
316 B
Plaintext
Executable File
15 lines
316 B
Plaintext
Executable File
function as_user {
|
|
local user="$1"
|
|
local user_pid=$(ps -axj | awk "/^$user / {print \$2;exit}")
|
|
local command="sudo launchctl bsexec $user_pid sudo -u '$user' $2"
|
|
echo "Running:"
|
|
echo "$command"
|
|
eval $command
|
|
}
|
|
|
|
function as_current_user {
|
|
as_user "$(whoami)" "$*"
|
|
}
|
|
|
|
as_current_user "$*"
|