
# --no-net
# read all file only
# --no-fork
# using pledge is sufficient.

___x_cmd_sb_stdiorun(){
    [ $# -gt 0 ]    || set -- --help
    case "$1" in
        -h|--help)      ___x_cmd help -m sb stdiorun "$@" ;;
    esac

    ! ___x_cmd_is_termux || N=sb M="Unsupported system -> termux" log:ret:1

    local x_
    ___x_cmd os name_

    case "$x_" in
        darwin)     ___x_cmd_sb_stdiorun___sb       "$@" ;;
        linux)      ___x_cmd_sb_stdiorun___pldg     "$@" ;;
        *)
                    if [ -z "$___X_CMD_SB_RUN_ANYWAY" ]; then
                        N=sb M="Unsupported system -> $x_" log:ret:1
                    else
                        "$@"
                    fi
                    ;;
    esac
}

___x_cmd_sb_stdiorun___sb(){
    ___x_cmd mac sb -9 --no-net --no-fork -a 'rx:/' -- "$@"
}

___x_cmd_sb_stdiorun___pldg(){
    ___x_cmd pldg -9 --no-net --no 'cpath wpath proc' -v 'rx:/' -- "$@"
}
