deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Disabling default_timeout for run/runLocally has no effect

Open alexgit2k opened this issue 3 years ago • 2 comments

For disabling the timeout for run/runLocally default_timeout should be set to null: https://deployer.org/docs/7.x/recipe/common#default_timeout

Example:

<?php
namespace Deployer;

set('default_timeout', null);

localhost('test');

task('sleep5', function () {
  run('sleep 5');
});
task('sleep10', function () {
  run('sleep 10');
});
task('sleep500', function () {
  run('sleep 500');
});

But dep sleep500 still quits at the default timeout of 300 seconds. However, it looks like setting it to 0 instead of null is disabling the timeout: set('default_timeout', 0);

Occurrences: https://github.com/deployphp/deployer/blob/a14383ba5931c2dd99d438fdbe6a18c46eb18788/recipe/common.php#L53 https://github.com/deployphp/deployer/blob/a14383ba5931c2dd99d438fdbe6a18c46eb18788/src/functions.php#L349 https://github.com/deployphp/deployer/blob/a14383ba5931c2dd99d438fdbe6a18c46eb18788/docs/api.md#L230

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

alexgit2k avatar Jan 13 '23 14:01 alexgit2k

I can confirm the issue. I think the problem is in \Deployer\run function:

    foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
        if ($$arg !== null) {
            $namedArguments[$arg] = $$arg;
        }
    }

and in \Deployer\runLocally function:

    foreach (['timeout', 'idle_timeout', 'secret', 'env', 'shell'] as $arg) {
        if ($$arg !== null) {
            $namedArguments[$arg] = $$arg;
        }
    }

The if statement in the loops removes the timeout parameter passed to the function.

lamasfoker avatar Jun 26 '24 09:06 lamasfoker

Setting to 0 disables the timeout.

antonmedv avatar Jun 26 '24 10:06 antonmedv