Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread Gisle Vanem

 Commit: efa5488448771f9cf6554b137d388ea5f3dc90c6
 
https://github.com/bagder/curl/commit/efa5488448771f9cf6554b137d388ea5f3dc90c6
 Author: Marc Hoersken i...@marc-hoersken.de
 Date:   2013-04-06 (Sat, 06 Apr 2013)

..

 ftp.pm: Made Perl testsuite able to kill Windows processes


This patch uses a tool from Windows-XP Professional:
 system(taskkill $filter nul 21);

I run Windows-XP Home and have no such tool. AFAICS,
one cannot get this from MS w/o having a pro version.
Isn't there a better alternative (like pskill)?

--gv
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread Marc Hoersken
Hi Gisle,

2013/4/6 Gisle Vanem gva...@broadpark.no:
  ftp.pm: Made Perl testsuite able to kill Windows processes


 This patch uses a tool from Windows-XP Professional:
  system(taskkill $filter nul 21);

 I run Windows-XP Home and have no such tool. AFAICS,
 one cannot get this from MS w/o having a pro version.
 Isn't there a better alternative (like pskill)?

I am currently testing on Windows 7, so I was not sure if it's
available on earlier versions. Thanks for the input. I will have to
see if there is a better command to check and kill PIDs.

The problem with pskill is that it would have to be manually installed
by test users.

Best regards,
Marc
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread LRN
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06.04.2013 14:49, Marc Hoersken wrote:
 Hi Gisle,
 
 2013/4/6 Gisle Vanem gva...@broadpark.no:
 ftp.pm: Made Perl testsuite able to kill Windows processes
 
 
 This patch uses a tool from Windows-XP Professional: 
 system(taskkill $filter nul 21);
 
 I run Windows-XP Home and have no such tool. AFAICS, one cannot
 get this from MS w/o having a pro version. Isn't there a better
 alternative (like pskill)?
 
 I am currently testing on Windows 7, so I was not sure if it's 
 available on earlier versions. Thanks for the input. I will have
 to see if there is a better command to check and kill PIDs.
 
 The problem with pskill is that it would have to be manually
 installed by test users.
You can use Win32API Perl module and TerminateProcess or
SafeTerminateProcess.
Also, CreateJobObject + AssignProcessToJobObject can be used to
implement behaviour similar to kill -pid. Obviously, that also
requires Win32API module.

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRYCz6AAoJEOs4Jb6SI2CwOnsH/3UkYOqnawA/21Mr3a0Uar97
x/7E/lmYSFROvDq5l7XWFnMIyjIqXSuo/MrXe1JraCLsWh53JQHjWIyLwNLW+i6z
YFQkFnFraT1X7Vw0ej44/28ntID4OgIsBeJ5iyeQz9TG3s09DXTJQSEWTvfQ8dyr
ssHQsAArSpW0Rtp8s3sMr0cQx9lIifgqO7+DDcPfWH7OgMFpOD5d0yXc1u0tX5qz
lm8kOrN6USPfLaulw7oHZA9S2i8NUCNgWW3Td+H+IZ1fcuu/XUiLVCo/QbOOqm7+
5qbbuK+XTbXc27gi2LAfZzLrcyiypgpm2vVCTvBOmMZSi91f58ABxI4v5Q0f3LM=
=Rpoo
-END PGP SIGNATURE-
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread Marc Hoersken
Hi LRN,

2013/4/6 LRN lrn1...@gmail.com:
 You can use Win32API Perl module and TerminateProcess or
 SafeTerminateProcess.
 Also, CreateJobObject + AssignProcessToJobObject can be used to
 implement behaviour similar to kill -pid. Obviously, that also
 requires Win32API module.

I added support for Windows XP by also using tskill to terminate the process.
I personally don't like the idea of adding new third-party Perl
modules with Windows API dependencies, unless it's a requirement. Any
objections?

Best regards,
Marc
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread LRN
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06.04.2013 19:12, Marc Hoersken wrote:
 Hi LRN,
 
 2013/4/6 LRN lrn1...@gmail.com:
 You can use Win32API Perl module and TerminateProcess or 
 SafeTerminateProcess. Also, CreateJobObject +
 AssignProcessToJobObject can be used to implement behaviour
 similar to kill -pid. Obviously, that also requires Win32API
 module.
 
 I added support for Windows XP by also using tskill to terminate
 the process. I personally don't like the idea of adding new
 third-party Perl modules with Windows API dependencies, unless it's
 a requirement. Any objections?
The only advice i can give is to treat tskill failures gracefully. W32
is known to put processes into a state in which they still exist, but
cannot be interacted with, probably due to the fact that OS is
dismantling them at the moment. Killing such process at that time will
fail with Access denied, no matter who you are or what permissions
you have.
If that happens, i'd advise to wait for a second or two (the best way
is to wait on process termination, but that requires Win32API; you can
instead just wait for short amounts of time in a loop, then check
whether the process is dead; or just wait for the full amount of time,
if performance is not a goal), then check if the process is still
alive and try again if it still is.

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRYD70AAoJEOs4Jb6SI2CwTL0H/jnPMHplHvKkV7PAgB3hL7Ir
GNDqtvUW8y+vWZBCWd3NQkBvnIwsg2JrkydYcTS7O4X7UaaSvh4pF0NJwQ0fg/Q2
uzfaffrZNPyi6E8PPt6IAuEVXWxP7T112ZB32XQbs+CMncSxjPDqNxLL/HU6M0Bx
IebnjSFir/X4dzfKVJDcVKyACiP/ZAn9An1LCizn8axPpOCnjTM2iheIlGHqaUYX
XlJiUnBulmOGOjldk4SxUImiF3dSOeZ7uue8xg55nROnGwHIh/9IGuFlL7S9/+qv
4Bl9gOA+wATt+0AjS36gIw/EIlu1xEf1wnUAUApSNUMjdlAERfB0KYakGw5wfhY=
=37B/
-END PGP SIGNATURE-
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


Re: [bagder/curl] efa548: ftp.pm: Made Perl testsuite able to kill Windows p...

2013-04-06 Thread Marc Hoersken
Hi LRN,

2013/4/6 LRN lrn1...@gmail.com:
 The only advice i can give is to treat tskill failures gracefully. W32
 is known to put processes into a state in which they still exist, but
 cannot be interacted with, probably due to the fact that OS is
 dismantling them at the moment. Killing such process at that time will
 fail with Access denied, no matter who you are or what permissions
 you have.
 If that happens, i'd advise to wait for a second or two (the best way
 is to wait on process termination, but that requires Win32API; you can
 instead just wait for short amounts of time in a loop, then check
 whether the process is dead; or just wait for the full amount of time,
 if performance is not a goal), then check if the process is still
 alive and try again if it still is.

thanks for the advice. As for as I can tell, the Perl testsuite
already takes care of checking multiple times to see if a process is
still alive. And there are multiple places it tries to kill and
cleanup obsolete processes. I am currently heavily testing the
testsuite on Windows 7 while trying to eliminate corner cases.

Best regards,
Marc
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html