Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/ChildProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,22 @@ public function all(): array
return $hydrated;
}

/**
* @param string|string[] $cmd
* @return $this
*/
public function start(
string|array $cmd,
string $alias,
?string $cwd = null,
?array $env = null,
bool $persistent = false
): static {
$cmd = is_array($cmd) ? array_values($cmd) : [$cmd];

$process = $this->client->post('child-process/start', [
'alias' => $alias,
'cmd' => (array) $cmd,
'cmd' => $cmd,
'cwd' => $cwd ?? base_path(),
'env' => $env,
'persistent' => $persistent,
Expand All @@ -70,11 +75,17 @@ public function start(
return $this->fromRuntimeProcess($process);
}

/**
* @param string|string[] $cmd
* @return $this
*/
public function php(string|array $cmd, string $alias, ?array $env = null, ?bool $persistent = false): self
{
$cmd = is_array($cmd) ? array_values($cmd) : [$cmd];

$process = $this->client->post('child-process/start-php', [
'alias' => $alias,
'cmd' => (array) $cmd,
'cmd' => $cmd,
'cwd' => $cwd ?? base_path(),
'env' => $env,
'persistent' => $persistent,
Expand All @@ -83,9 +94,15 @@ public function php(string|array $cmd, string $alias, ?array $env = null, ?bool
return $this->fromRuntimeProcess($process);
}

/**
* @param string|string[] $cmd
* @return $this
*/
public function artisan(string|array $cmd, string $alias, ?array $env = null, ?bool $persistent = false): self
{
$cmd = ['artisan', ...(array) $cmd];
$cmd = is_array($cmd) ? array_values($cmd) : [$cmd];

$cmd = ['artisan', ...$cmd];

return $this->php($cmd, $alias, env: $env, persistent: $persistent);
}
Expand Down
Loading