Skip to content

Commit 3666878

Browse files
committed
Add more run params
1 parent 79c8053 commit 3666878

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/Import/MamlRecipe.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ private function schema(): SchemaType
5656
$run = S::object([
5757
'run' => S::string(),
5858
'cd' => S::optional(S::string()),
59+
'cwd' => S::optional(S::string()),
60+
'env' => S::optional(S::map(S::string())),
61+
'secrets' => S::optional(S::map(S::string())),
62+
'nothrow' => S::optional(S::boolean()),
63+
'forceOutput' => S::optional(S::boolean()),
64+
'timeout' => S::optional(S::number()),
65+
'idleTimeout' => S::optional(S::number()),
5966
]);
6067

6168
$runLocally = S::object([
@@ -316,6 +323,13 @@ private function createTask(string $name, ArrayNode $array, string $desc)
316323
try {
317324
run(
318325
$step['run'],
326+
cwd: $step['cwd'] ?? null,
327+
env: $step['env'] ?? null,
328+
secrets: $step['secrets'] ?? null,
329+
nothrow: $step['nothrow'] ?? false,
330+
forceOutput: $step['forceOutput'] ?? false,
331+
timeout: $step['timeout'] ?? null,
332+
idleTimeout: $step['idleTimeout'] ?? null,
319333
);
320334
} catch (\Throwable $e) {
321335
$this->wrapException($e, $property->span);
@@ -354,7 +368,7 @@ private function createTask(string $name, ArrayNode $array, string $desc)
354368
}
355369
},
356370
'desc', 'once', 'hidden', 'limit', 'select' => $task->$key($step[$key]),
357-
default => $this->throwException("Unknown task step $key", $property->key->span),
371+
default => $body,
358372
};
359373
}
360374
}

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function run(
402402
): string {
403403
$runParams = new RunParams(
404404
shell: currentHost()->getShell(),
405-
cwd: $cwd ?? has('working_path') ? get('working_path') : null,
405+
cwd: $cwd ?? (has('working_path') ? get('working_path') : null),
406406
env: array_merge_alternate(get('env', []), $env ?? []),
407407
nothrow: $nothrow,
408408
timeout: $timeout ?? get('default_timeout', 300),

0 commit comments

Comments
 (0)