Prechádzať zdrojové kódy

Add a helper to disable process timeouts

The helper can be included in custom script definitions by calling
"Composer\\Config::disableProcessTimeout".

Example:

{
  "scripts": {
    "watch": [
      "Composer\\Config::disableProcessTimeout",
      "vendor/bin/long-running-script --watch"
    ]
  }
}
Kevin Boyd 6 rokov pred
rodič
commit
5633a68689
1 zmenil súbory, kde vykonal 17 pridanie a 0 odobranie
  1. 17 0
      src/Composer/Config.php

+ 17 - 0
src/Composer/Config.php

@@ -16,6 +16,7 @@ use Composer\Config\ConfigSourceInterface;
 use Composer\Downloader\TransportException;
 use Composer\IO\IOInterface;
 use Composer\Util\Platform;
+use Composer\Util\ProcessExecutor;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -459,4 +460,20 @@ class Config
             }
         }
     }
+
+    /**
+     * Used by long-running custom scripts in composer.json
+     *
+     * "scripts": {
+     *   "watch": [
+     *     "Composer\\Config::disableProcessTimeout",
+     *     "vendor/bin/long-running-script --watch"
+     *   ]
+     * }
+     */
+    public static function disableProcessTimeout()
+    {
+        // Override global timeout set earlier by environment or config
+        ProcessExecutor::setTimeout(0);
+    }
 }