modifs.mineures sans commentaires
This commit is contained in:
parent
1282dc6365
commit
60c9c4a2fb
|
@ -11,6 +11,7 @@ $argv = array_merge(
|
|||
);
|
||||
|
||||
$app_params = unserialize(file_get_contents($paramsfile));
|
||||
@unlink($paramsfile);
|
||||
require $app_params["vendor"]["autoload"];
|
||||
|
||||
use nur\cli\Application;
|
||||
|
|
|
@ -3,6 +3,7 @@ namespace nur\sery\app;
|
|||
|
||||
use nur\sery\cl;
|
||||
use nur\sery\file\TmpfileWriter;
|
||||
use nur\sery\os\path;
|
||||
use nur\sery\os\proc\Cmd;
|
||||
use nur\sery\output\msg;
|
||||
use nur\sery\StateException;
|
||||
|
@ -18,7 +19,7 @@ class launcher {
|
|||
* - les valeurs séquentielles sont prises telles quelles
|
||||
*/
|
||||
static function verifix_args(array $args): array {
|
||||
if (cl::is_list($args)) return $args;
|
||||
if (!cl::is_list($args)) {
|
||||
$fixedArgs = [];
|
||||
$index = 0;
|
||||
foreach ($args as $arg => $value) {
|
||||
|
@ -35,7 +36,11 @@ class launcher {
|
|||
$fixedArgs[] = "--$arg";
|
||||
if ($value !== true) $fixedArgs[] = "$value";
|
||||
}
|
||||
return $fixedArgs;
|
||||
$args = $fixedArgs;
|
||||
}
|
||||
# corriger le chemin de l'application pour qu'il soit absolu et normalisé
|
||||
$args[0] = path::abspath($args[0]);
|
||||
return $args;
|
||||
}
|
||||
|
||||
static function launch(string $appClass, array $args): int {
|
||||
|
@ -46,7 +51,7 @@ class launcher {
|
|||
$launch_php = __DIR__."/../../lib/_launch.php";
|
||||
}
|
||||
$tmpfile = new TmpfileWriter();
|
||||
$tmpfile->serialize($app->getParams());
|
||||
$tmpfile->keep()->serialize($app->getParams());
|
||||
|
||||
$args = self::verifix_args($args);
|
||||
$cmd = new Cmd([
|
||||
|
|
|
@ -39,6 +39,12 @@ class TmpfileWriter extends FileWriter {
|
|||
/** @var bool */
|
||||
protected $delete;
|
||||
|
||||
/** désactiver la suppression automatique du fichier temporaire */
|
||||
function keep(): self {
|
||||
$this->delete = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->close();
|
||||
if ($this->delete) $this->delete();
|
||||
|
|
Loading…
Reference in New Issue