Skip to content

Commit 563806c

Browse files
JamesWTruhermirichmo
authored andcommitted
Change native execution tests to use df instead of stty (PowerShell#3685)
when automating test execution, some environments don't have a tty which causes the tests to fail. df is just as good a test as stty as it is also guaranteed to be present. This change also allows the tests to be run on OSX
1 parent 2a739af commit 563806c

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

test/powershell/Language/Scripting/NativeExecution/NativeLinuxCommands.Tests.ps1

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
if ( $IsWindows ) {
22
$PesterSkipOrPending = @{ Skip = $true }
33
}
4-
elseif ( $IsOSX ) {
5-
$PesterSkipOrPending = @{ Pending = $true }
6-
}
74
else {
85
$PesterSkipOrPending = @{}
96
}
@@ -27,15 +24,15 @@ Describe "NativeLinuxCommands" -tags "CI" {
2724
}
2825

2926
It "Should not redirect standard input if native command is the first command in pipeline (1)" @PesterSkipOrPending {
30-
stty | ForEach-Object -Begin { $out = @() } -Process { $out += $_ }
27+
df | ForEach-Object -Begin { $out = @() } -Process { $out += $_ }
3128
$out.Length -gt 0 | Should Be $true
32-
$out[0] -like "speed * baud; line =*" | Should Be $true
29+
$out[0] -like "Filesystem*Available*" | Should Be $true
3330
}
3431

3532
It "Should not redirect standard input if native command is the first command in pipeline (2)" @PesterSkipOrPending {
36-
$out = stty
33+
$out = df
3734
$out.Length -gt 0 | Should Be $true
38-
$out[0] -like "speed * baud; line =*" | Should Be $true
35+
$out[0] -like "Filesystem*Available*" | Should Be $true
3936
}
4037
}
4138

0 commit comments

Comments
 (0)