Skip to content

Commit 20173bd

Browse files
committed
Easier way to set env
1 parent 7fa8506 commit 20173bd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Commands/Concerns/ManagesProcess.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ trait ManagesProcess
3939

4040
protected $children = [];
4141

42+
protected $environment = [];
43+
4244
public function createPendingProcess(): PendingProcess
4345
{
4446
$this->input ??= new InputStream;
@@ -83,6 +85,7 @@ public function createPendingProcess(): PendingProcess
8385
'FORCE_COLOR' => '1',
8486
'COLUMNS' => $this->scrollPaneWidth(),
8587
'LINES' => $this->scrollPaneHeight(),
88+
...$this->environment,
8689
...$process->environment
8790
]);
8891
}
@@ -127,6 +130,13 @@ public function withProcess(Closure $cb)
127130
return $this;
128131
}
129132

133+
public function withEnv(array $env)
134+
{
135+
$this->environment = $env;
136+
137+
return $this;
138+
}
139+
130140
public function autostart(): static
131141
{
132142
if ($this->autostart && $this->processStopped()) {

0 commit comments

Comments
 (0)