Skip to content

Commit 1260d75

Browse files
ENGCOM-4124: Direct STDERR output when listing crontab to /dev/null #20951
- Merge Pull Request #20951 from danielatdattrixdotcom/magento2:patch-1 - Merged commits: 1. 528864d 2. 23a5f01
2 parents 9afd4c6 + 23a5f01 commit 1260d75

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/internal/Magento/Framework/Crontab/CrontabManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function cleanMagentoSection($content)
182182
private function getCrontabContent()
183183
{
184184
try {
185-
$content = (string)$this->shell->execute('crontab -l');
185+
$content = (string)$this->shell->execute('crontab -l 2>/dev/null');
186186
} catch (LocalizedException $e) {
187187
return '';
188188
}

lib/internal/Magento/Framework/Crontab/Test/Unit/CrontabManagerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testGetTasksNoCrontab()
5858

5959
$this->shellMock->expects($this->once())
6060
->method('execute')
61-
->with('crontab -l', [])
61+
->with('crontab -l 2>/dev/null', [])
6262
->willThrowException($localizedException);
6363

6464
$this->assertEquals([], $this->crontabManager->getTasks());
@@ -74,7 +74,7 @@ public function testGetTasks($content, $tasks)
7474
{
7575
$this->shellMock->expects($this->once())
7676
->method('execute')
77-
->with('crontab -l', [])
77+
->with('crontab -l 2>/dev/null', [])
7878
->willReturn($content);
7979

8080
$this->assertEquals($tasks, $this->crontabManager->getTasks());
@@ -127,7 +127,7 @@ public function testRemoveTasksWithException()
127127

128128
$this->shellMock->expects($this->at(0))
129129
->method('execute')
130-
->with('crontab -l', [])
130+
->with('crontab -l 2>/dev/null', [])
131131
->willReturn('');
132132

133133
$this->shellMock->expects($this->at(1))
@@ -148,7 +148,7 @@ public function testRemoveTasks($contentBefore, $contentAfter)
148148
{
149149
$this->shellMock->expects($this->at(0))
150150
->method('execute')
151-
->with('crontab -l', [])
151+
->with('crontab -l 2>/dev/null', [])
152152
->willReturn($contentBefore);
153153

154154
$this->shellMock->expects($this->at(1))
@@ -276,7 +276,7 @@ public function testSaveTasks($tasks, $content, $contentToSave)
276276

277277
$this->shellMock->expects($this->at(0))
278278
->method('execute')
279-
->with('crontab -l', [])
279+
->with('crontab -l 2>/dev/null', [])
280280
->willReturn($content);
281281

282282
$this->shellMock->expects($this->at(1))

0 commit comments

Comments
 (0)