Troglodyne-Internet-Widgets / selenium-client-perl

WC3 Selenium client for Perl
6 stars 4 forks source link

Selenium::Client::DESTROY always causes process to exit with non-zero status? #6

Closed cgf1 closed 3 years ago

cgf1 commented 3 years ago

I don't understand why from looking at the code but something in DESTROY is causing programs to exit with a 15 (SIGTERM) status:

% /tmp/tst; echo $? /tmp/tst; echo $? /usr/local/bin/geckodriver --port 36047 Waiting for port to come up...done GET http://127.0.0.1:36047/status 200 : {"value":{"message":"","ready":true}} POST http://127.0.0.1:36047/session Body: {"capabilities":{"alwaysMatch":{"browserName":"firefox","moz:firefoxOptions":{}}}} 200 : {"value":{"sessionId":"ebe4cec0-7381-4980-a745-b4b91e3c73d2","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"78.8.0","moz:accessibilityChecks":false,"moz:buildID":"20210217034806","moz:geckodriverVersion":"0.29.0","moz:headless":false,"moz:processID":3545,"moz:profile":"/tmp/rust_mozprofileTWbxC8","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"linux","platformVersion":"5.11.11-gentoo-x86_64","rotatable":false,"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}} My pid 3541 Shutting down active sessions... DELETE http://127.0.0.1:36047/session/ebe4cec0-7381-4980-a745-b4b91e3c73d2 200 : {"value":null} Attempting to kill server process... Issued SIGTERM to 3542, waiting... 15

The test file: !/usr/bin/perl use Selenium::Client; my $drv = Selenium::Client->new(browser => 'firefox', debug => 1, driver => 'Auto', version => 'draft', headless => 0); my ($cap, $ses) = $drv->NewSession(); print "My pid $$\n"; exit 0;

If I set auto_close=0 and just kill geckodriver myself, I don't seem to have this issue.

cgf1 commented 3 years ago

And, of course, I realized why two seconds after filing this bug report. DESTROY needs a "local $?" or $? will override the script's exit value.

teodesian commented 3 years ago

Good catch, I think I forgot this in the playwright module too.

File another under "I should know better, and actually do"

teodesian commented 3 years ago

merged associated PR