Skip to content

Commit d130484

Browse files
authored
Merge pull request #76 from CaptnCodr/feature/ArgumentList-improvement
Use ProcessStartInfo.ArgumentList if NET (>= net5.0)
2 parents 47b4f39 + bc2f7a9 commit d130484

16 files changed

Lines changed: 664 additions & 580 deletions

.config/dotnet-tools.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
"isRoot": true,
44
"tools": {
55
"paket": {
6-
"version": "8.0.0",
6+
"version": "9.0.2",
77
"commands": [
88
"paket"
9-
]
9+
],
10+
"rollForward": false
1011
},
1112
"fantomas": {
12-
"version": "6.2.3",
13+
"version": "7.0.1",
1314
"commands": [
1415
"fantomas"
15-
]
16+
],
17+
"rollForward": false
1618
}
1719
}
1820
}

.paket/Paket.Restore.targets

Lines changed: 505 additions & 497 deletions
Large diffs are not rendered by default.

paket.lock

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,47 @@ RESTRICTION: || (== net6.0) (== net7.0) (== net8.0) (== netstandard2.0) (== nets
22
NUGET
33
remote: https://api.nuget.org/v3/index.json
44
FSharp.Core (6.0.7)
5-
FsUnit (5.6)
5+
FsUnit (7.0.1)
66
FSharp.Core (>= 5.0.2)
7-
NUnit (>= 3.14)
8-
Microsoft.CodeCoverage (17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
9-
Microsoft.NET.Test.Sdk (17.8)
10-
Microsoft.CodeCoverage (>= 17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
11-
Microsoft.TestPlatform.TestHost (>= 17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
12-
Microsoft.NETCore.Platforms (7.0.4)
13-
Microsoft.TestPlatform.ObjectModel (17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
14-
NuGet.Frameworks (>= 6.5)
7+
NUnit (>= 4.0.1)
8+
Microsoft.ApplicationInsights (2.23) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
9+
System.Diagnostics.DiagnosticSource (>= 5.0)
10+
Microsoft.CodeCoverage (17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
11+
Microsoft.NET.Test.Sdk (17.13)
12+
Microsoft.CodeCoverage (>= 17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
13+
Microsoft.TestPlatform.TestHost (>= 17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
14+
Microsoft.Testing.Extensions.Telemetry (1.6.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
15+
Microsoft.ApplicationInsights (>= 2.22)
16+
Microsoft.Testing.Platform (>= 1.6.3)
17+
Microsoft.Testing.Extensions.TrxReport.Abstractions (1.6.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
18+
Microsoft.Testing.Platform (>= 1.6.3)
19+
Microsoft.Testing.Extensions.VSTestBridge (1.6.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
20+
Microsoft.Testing.Extensions.Telemetry (>= 1.6.3)
21+
Microsoft.Testing.Extensions.TrxReport.Abstractions (>= 1.6.3)
22+
Microsoft.Testing.Platform (>= 1.6.3)
23+
Microsoft.TestPlatform.ObjectModel (>= 17.13)
24+
Microsoft.Testing.Platform (1.6.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
25+
Microsoft.Testing.Platform.MSBuild (1.6.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
26+
Microsoft.Testing.Platform (>= 1.6.3)
27+
Microsoft.TestPlatform.ObjectModel (17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
1528
System.Reflection.Metadata (>= 1.6)
16-
Microsoft.TestPlatform.TestHost (17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
17-
Microsoft.TestPlatform.ObjectModel (>= 17.8) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
29+
Microsoft.TestPlatform.TestHost (17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
30+
Microsoft.TestPlatform.ObjectModel (>= 17.13) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
1831
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
19-
NETStandard.Library (2.0.3)
20-
Microsoft.NETCore.Platforms (>= 1.1)
2132
Newtonsoft.Json (13.0.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
22-
NuGet.Frameworks (6.7) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
23-
NUnit (3.14)
24-
NETStandard.Library (>= 2.0)
25-
NUnit.Analyzers (3.9)
26-
NUnit3TestAdapter (4.5)
27-
System.Collections.Immutable (8.0) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
28-
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< net7.0)) (== netstandard2.0) (== netstandard2.1)
29-
System.Reflection.Metadata (8.0) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
30-
System.Collections.Immutable (>= 8.0)
31-
System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (== net6.0) (&& (== net7.0) (== netstandard2.0)) (&& (== net7.0) (== netstandard2.1)) (&& (== net7.0) (>= net462)) (&& (== net7.0) (< net6.0)) (&& (== net8.0) (== netstandard2.0)) (&& (== net8.0) (== netstandard2.1)) (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< net7.0)) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net6.0)) (&& (== netstandard2.1) (>= netcoreapp3.1))
33+
NUnit (4.3.2)
34+
NUnit.Analyzers (4.7)
35+
NUnit3TestAdapter (5.0)
36+
Microsoft.Testing.Extensions.VSTestBridge (>= 1.5.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
37+
Microsoft.Testing.Platform.MSBuild (>= 1.5.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
38+
System.Collections.Immutable (9.0.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
39+
System.Memory (>= 4.5.5) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (>= net462)) (== netstandard2.0) (== netstandard2.1)
40+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (>= net462)) (== netstandard2.0) (== netstandard2.1)
41+
System.Diagnostics.DiagnosticSource (9.0.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= net462)) (&& (== netstandard2.1) (>= netcoreapp3.1))
42+
System.Memory (>= 4.5.5) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (>= net462)) (== netstandard2.0) (== netstandard2.1)
43+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (>= net462)) (== netstandard2.0) (== netstandard2.1)
44+
System.Memory (4.6.3) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (== netstandard2.0)) (&& (== net8.0) (== netstandard2.1)) (&& (== net8.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
45+
System.Reflection.Metadata (9.0.3) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))
46+
System.Collections.Immutable (>= 9.0.3)
47+
System.Memory (>= 4.5.5) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (>= net462)) (== netstandard2.0) (== netstandard2.1)
48+
System.Runtime.CompilerServices.Unsafe (6.1.2) - restriction: || (== net6.0) (== net7.0) (&& (== net8.0) (== netstandard2.0)) (&& (== net8.0) (== netstandard2.1)) (&& (== net8.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1)) (&& (== netstandard2.1) (>= netcoreapp3.1))

src/Fli.Tests/ExecContext/ExecCommandConfigureUnixTests.fs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ open System.Text
1010
[<Test>]
1111
[<Platform("Linux,Unix,MacOsX")>]
1212
let ``Check FileName in ProcessStartInfo Exec program`` () =
13-
cli { Exec "bash" }
14-
|> Command.buildProcess
15-
|> _.FileName
16-
|> should equal "bash"
13+
cli { Exec "bash" } |> Command.buildProcess |> _.FileName |> should equal "bash"
1714

1815
[<Test>]
1916
[<Platform("Linux,Unix,MacOsX")>]
@@ -120,4 +117,4 @@ let ``Check all possible values in ProcessStartInfo`` () =
120117
config.Environment.Contains(KeyValuePair("Fli", "test")) |> should be True
121118
config.Environment.Contains(KeyValuePair("Fli.Test", "test")) |> should be True
122119
config.StandardOutputEncoding |> should equal Encoding.UTF8
123-
config.StandardErrorEncoding |> should equal Encoding.UTF8
120+
config.StandardErrorEncoding |> should equal Encoding.UTF8

src/Fli.Tests/ExecContext/ExecCommandConfigureWindowsTests.fs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ let ``Check Arguments in ProcessStartInfo with Arguments`` () =
2626
|> _.Arguments
2727
|> should equal "-c echo Hello World!"
2828

29+
#if NET
30+
[<Test>]
31+
[<Platform("Win")>]
32+
let ``Check Arguments in ProcessStartInfo with ArgumentList`` () =
33+
cli {
34+
Exec "cmd.exe"
35+
Arguments [ "-c"; "echo Hello World!" ]
36+
}
37+
|> Command.buildProcess
38+
|> _.ArgumentList
39+
:> seq<_>
40+
|> should
41+
equal
42+
(seq {
43+
"-c"
44+
"echo Hello World!"
45+
})
46+
#endif
47+
2948
[<Test>]
3049
[<Platform("Win")>]
3150
let ``Check WorkingDirectory in ProcessStartInfo with WorkingDirectory`` () =
@@ -153,4 +172,4 @@ let ``Check all possible values in ProcessStartInfo for windows`` () =
153172
config.Environment.Contains(KeyValuePair("Fli.Test", "test")) |> should be True
154173
config.StandardOutputEncoding |> should equal Encoding.UTF8
155174
config.StandardErrorEncoding |> should equal Encoding.UTF8
156-
config.WindowStyle |> should equal Diagnostics.ProcessWindowStyle.Normal
175+
config.WindowStyle |> should equal Diagnostics.ProcessWindowStyle.Normal

src/Fli.Tests/ExecContext/ExecCommandExecuteUnixTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ let ``Passing data to a progrma on stdin`` () =
9292
}
9393
|> Command.execute
9494
|> Output.toText
95-
|> should equal "Test"
95+
|> should equal "Test"

src/Fli.Tests/ExecContext/ExecCommandExecuteWindowsTests.fs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ let ``Hello World with executing program`` () =
1818
|> Output.toText
1919
|> should equal "Hello World!"
2020

21+
[<Test>]
22+
[<Platform("Win")>]
23+
let ``Print "Test" properly with ArgumentList`` () =
24+
cli {
25+
Exec "pwsh.exe"
26+
Arguments [ "/C"; "Write-Host \"Test\"" ]
27+
}
28+
|> Command.execute
29+
|> Output.toText
30+
|> should equal "Test"
31+
2132
[<Test>]
2233
[<Platform("Win")>]
2334
let ``Get process Id`` () =
@@ -110,4 +121,4 @@ let ``Hello World with executing program throws exception with unknown Verb`` ()
110121
|> ignore
111122
with :? ArgumentException as ex ->
112123
ex.Message
113-
|> should equal ("Unknown verb 'print'. Possible verbs on 'cmd.exe': open, runas, runasuser")
124+
|> should equal ("Unknown verb 'print'. Possible verbs on 'cmd.exe': open, runas, runasuser")

src/Fli.Tests/ExecContext/ExecConfigTests.fs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let ``Check arguments config for executing program`` () =
1616
Arguments "echo Hello World!"
1717
}
1818
|> _.config.Arguments
19-
|> should equal (Some "echo Hello World!")
19+
|> should equal (Some(Arguments(Some "echo Hello World!")))
2020

2121
[<Test>]
2222
let ``Check arguments list config for executing program`` () =
@@ -25,7 +25,7 @@ let ``Check arguments list config for executing program`` () =
2525
Arguments [ "echo"; "Hello World!" ]
2626
}
2727
|> _.config.Arguments
28-
|> should equal (Some "echo Hello World!")
28+
|> should equal (Some(ArgumentList(Some [| "echo"; "Hello World!" |])))
2929

3030
[<Test>]
3131
let ``Check Input config for executing program`` () =
@@ -51,15 +51,17 @@ let ``Empty string in Output ends up as None`` () =
5151
Exec "cmd.exe"
5252
Output ""
5353
}
54-
|> _.config.Output |> should be (ofCase <@ None @>)
54+
|> _.config.Output
55+
|> should be (ofCase <@ None @>)
5556

5657
[<Test>]
5758
let ``Nullable file path in Output ends up as None`` () =
5859
cli {
5960
Exec "cmd.exe"
60-
Output (File(null))
61+
Output(File(null))
6162
}
62-
|> _.config.Output |> should be (ofCase <@ None @>)
63+
|> _.config.Output
64+
|> should be (ofCase <@ None @>)
6365

6466
[<Test>]
6567
let ``Check working directory config for executing program`` () =
@@ -74,7 +76,8 @@ let ``Check working directory config for executing program`` () =
7476
let ``Check WindowStyle config for executing program`` () =
7577
cli {
7678
Exec "cmd.exe"
77-
WindowStyle Normal }
79+
WindowStyle Normal
80+
}
7881
|> _.config.WindowStyle
7982
|> should equal (Some Normal)
8083

src/Fli.Tests/ShellContext/ShellCommandConfigureUnixTests.fs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ open System.Text
1010
[<Test>]
1111
[<Platform("Linux,Unix,MacOsX")>]
1212
let ``Check FileName in ProcessStartInfo with CMD Shell`` () =
13-
cli { Shell BASH }
14-
|> Command.buildProcess
15-
|> _.FileName
16-
|> should equal "bash"
13+
cli { Shell BASH } |> Command.buildProcess |> _.FileName |> should equal "bash"
1714

1815
[<Test>]
1916
[<Platform("Linux,Unix,MacOsX")>]

src/Fli.Tests/ShellContext/ShellConfigTests.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ let ``Empty string in Output ends up as None`` () =
4242
Shell CMD
4343
Output ""
4444
}
45-
|> _.config.Output |> should be (ofCase <@ None @>)
45+
|> _.config.Output
46+
|> should be (ofCase <@ None @>)
4647

4748
[<Test>]
4849
let ``Nullable file path in Output ends up as None`` () =
4950
cli {
5051
Shell CMD
51-
Output (File(null))
52+
Output(File(null))
5253
}
53-
|> _.config.Output |> should be (ofCase <@ None @>)
54+
|> _.config.Output
55+
|> should be (ofCase <@ None @>)
5456

5557
[<Test>]
5658
let ``Check WorkingDirectory config`` () =

0 commit comments

Comments
 (0)