Skip to content

Commit

Permalink
run pipes immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 11, 2023
1 parent a1b2196 commit e34ab39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Process/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ public function pool(callable $callback)
* @param callable $callback
* @return \Illuminate\Process\Pipe
*/
public function pipe(callable $callback)
public function pipe(callable $callback, ?callable $output = null)
{
return new Pipe($this, $callback);
return (new Pipe($this, $callback))->run(output: $output);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Process/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public function testProcessPipe()
$pipe->command('grep -i "foo"');
});

$this->assertSame("foo\n", $pipe->run()->output());
$this->assertSame("foo\n", $pipe->output());
}

public function testProcessPipeFailed()
Expand All @@ -531,7 +531,7 @@ public function testProcessPipeFailed()
$pipe->command('grep -i "foo"');
});

$this->assertTrue($pipe->run()->failed());
$this->assertTrue($pipe->failed());
}

public function testFakeInvokedProcessOutputWithLatestOutput()
Expand Down

0 comments on commit e34ab39

Please sign in to comment.