Thanks!  I applied this to master and branch-2.4.

On Thu, Jun 25, 2015 at 04:16:14PM +0000, Alin Serdean wrote:
> Tested with and w/o tskill
> 
> Acked-by: Alin Gabriel Serdean <aserd...@cloudbasesolutions.com>
> 
> 
> -----Mesaj original-----
> De la: dev [mailto:dev-boun...@openvswitch.org] În numele Ben Pfaff
> Trimis: Thursday, June 25, 2015 6:35 PM
> Către: dev@openvswitch.org
> Cc: Ben Pfaff
> Subiect: [ovs-dev] [PATCH] tests: Use taskkill if tskill is not available, on 
> Windows.
> 
> This is not the minimal change; it "improves" the rest of the code as well.
> 
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
> Needs testing.
> 
>  tests/ovs-macros.at | 48 +++++++++++++++++++++---------------------------
>  1 file changed, 21 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index c583c3d..d550204 
> 100644
> --- a/tests/ovs-macros.at
> +++ b/tests/ovs-macros.at
> @@ -37,37 +37,31 @@ if test "$IS_WIN32" = "yes"; then
>          command diff --strip-trailing-cr "$@"
>      }
>  
> +    # tskill is more effective than taskkill but it isn't always installed.
> +    if (tskill //?) >/dev/null 2>&1; then :; else
> +        tskill () { taskkill //F //PID $1 >/dev/null; }
> +    fi
> +
>      kill () {
> -        case "$1" in
> -            -0)
> -                shift
> -                for i in $*; do
> -                    # tasklist will always have return code 0.
> -                    # If pid does exist, there will be a line with the pid.
> -                    if tasklist //fi "PID eq $i" | grep $i >/dev/null; then
> -                        :
> -                    else
> -                        return 1
> -                    fi
> -                done
> -                return 0
> -                ;;
> -            -[1-9]*)
> -                shift
> -                for i in $*; do
> -                    if tasklist //fi "PID eq $i" | grep $i >/dev/null; then
> -                        tskill $i
> -                    fi
> -                done
> -                ;;
> +        signal=
> +        retval=0
> +        for arg; do
> +            case $arg in
> +            -*) signal=$arg ;;
>              [1-9][0-9]*)
> -                for i in $*; do
> -                    if tasklist //fi "PID eq $i" | grep $i >/dev/null; then
> -                        tskill $i
> +                # tasklist always returns 0.
> +                # If pid does exist, there will be a line with the pid.
> +                if tasklist //fi "PID eq $arg" | grep $arg >/dev/null; then
> +                    if test "X$signal" != "X-0"; then
> +                        tskill $arg
>                      fi
> -                done
> +                else
> +                    retval=1
> +                fi
>                  ;;
> -        esac
> +            esac
> +        done
> +        return $retval
>      }
>  fi
>  ]
> --
> 2.1.3
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to