Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --timeout parameter to run-script to override default timeout #4920

Merged
merged 1 commit into from Feb 16, 2016

Conversation

Projects
None yet
4 participants
@curry684
Copy link
Contributor

curry684 commented Feb 15, 2016

Fixes #4918

@Seldaek

This comment has been minimized.

Copy link
Member

Seldaek commented Feb 16, 2016

We already have https://getcomposer.org/doc/03-cli.md#composer-process-timeout - isn't that enough? It works for all commands at least.. cc @grifx

@curry684

This comment has been minimized.

Copy link
Contributor Author

curry684 commented Feb 16, 2016

He wants to run an API server as part of this package, that implies an infinite timeout. I don't think the global timeout should have to be disabled for a single exception, be it for an infinite script or one that could run longer than the default 300 in special cases.

This PR adds the option to ignore the global default on a per instance basis (that's why it is set after the new Composer call.

@Seldaek

This comment has been minimized.

Copy link
Member

Seldaek commented Feb 16, 2016

Aye fair enough. Doesn't hurt much and it's more self-documenting so I'll take it in, but the env var also lets you disable it for a single command you run which really is about the same.

Seldaek added a commit that referenced this pull request Feb 16, 2016

Merge pull request #4920 from curry684/issue-4918
Add a --timeout parameter to run-script to override default timeout

@Seldaek Seldaek merged commit 93501a5 into composer:master Feb 16, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@curry684

This comment has been minimized.

Copy link
Contributor Author

curry684 commented Feb 16, 2016

Good point actually that the documentation doesn't mention that COMPOSER_PROCESS_TIMEOUT=0 disables it - I found that out by experiment too.

@curry684 curry684 deleted the curry684:issue-4918 branch Feb 16, 2016

aminztw pushed a commit to aminztw/composer that referenced this pull request Jan 1, 2017

Merge pull request composer#4920 from curry684/issue-4918
Add a --timeout parameter to run-script to override default timeout
@igorsantos07

This comment has been minimized.

Copy link

igorsantos07 commented Jun 2, 2018

Wondering if it would be possible to pass that to script shortcuts? i.e. composer server --timeout=0 instead of composer run server --timeout=0. Currently, it spits out an "option does not exist" error. Running composer server --help does show the timeout option, but I guess the help aliases into run-script, while the main command doesn't work the same way?

@Antnee

This comment has been minimized.

Copy link

Antnee commented Mar 12, 2019

I'm just looking at this myself. We run everything inside Docker, and our dev environments have two dependencies; Docker and Composer. For example, we can run composer serve and the containers are spun up etc and everything works great.

However, if we want to have a long-running process, such as Webpack watching the files, we have a problem. We literally just enter composer webpack at the moment, but the script will eventually terminate. In order to get this to work, I need to enter composer run webpack --timeout=0, but there are no cases where I want this process to not run indefinitely.

I want this single command to have a custom timeout. This section of our scripts looks like this:

    "node":"docker-compose run --rm -w /app node",
    "npm-install": "@node npm install",
    "npm-rebuild-sass": "@node npm rebuild node-sass",
    "webpack": "@node webpack --watch",
    "webpack-compile": "@node webpack"
  }

Is it possible to have the timeout specified in the command, somehow? Rather than needing to pass in the longer command (which is less than ideal) or updating the entire app's timeout (even less ideal)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.