@@ -16,29 +16,35 @@ type private AzureEmulatorParams = {
16
16
let private AzureEmulatorDefaults = {
17
17
StorageEmulatorToolPath =
18
18
lazy
19
- let path = msSdkBasePath @@ " \A zure\S torage Emulator\A zureStorageEmulator.exe"
19
+ let path = msSdkBasePath @@ @ " \Azure\Storage Emulator\AzureStorageEmulator.exe"
20
20
if fileExists path then path
21
21
else failwith ( sprintf " Unable to locate Azure Storage Emulator at %s " path)
22
22
CSRunToolPath = " \" C:\P rogram Files\M icrosoft SDKs\W indows Azure\E mulator\c srun.exe\" "
23
23
TimeOut = TimeSpan.FromMinutes 5.
24
24
}
25
25
26
+ let private (| StorageAlreadyStarted | StorageAlreadyStopped | Ok | OtherError |) = function
27
+ | 0 -> Ok
28
+ | - 5 -> StorageAlreadyStarted
29
+ | - 6 -> StorageAlreadyStopped
30
+ | _ -> OtherError
31
+
26
32
/// Stops the storage emulator
27
33
let StopStorageEmulator = ( fun _ ->
28
- if 0 <> ExecProcess ( fun info ->
34
+ match ExecProcess ( fun info ->
29
35
info.FileName <- AzureEmulatorDefaults.StorageEmulatorToolPath.Value
30
- info.Arguments <- " stop" ) AzureEmulatorDefaults.TimeOut
31
- then
32
- failwithf " Azure Emulator Failure on stop Storage Emulator"
36
+ info.Arguments <- " stop" ) AzureEmulatorDefaults.TimeOut with
37
+ | Ok | StorageAlreadyStopped -> ()
38
+ | _ -> failwithf " Azure Emulator Failure on stop Storage Emulator"
33
39
)
34
40
35
41
/// Starts the storage emulator
36
42
let StartStorageEmulator = ( fun _ ->
37
- if 0 <> ExecProcess ( fun info ->
43
+ match ExecProcess ( fun info ->
38
44
info.FileName <- AzureEmulatorDefaults.StorageEmulatorToolPath.Value
39
- info.Arguments <- " start" ) AzureEmulatorDefaults.TimeOut
40
- then
41
- failwithf " Azure Emulator Failure on start Storage Emulator"
45
+ info.Arguments <- " start" ) AzureEmulatorDefaults.TimeOut with
46
+ | Ok | StorageAlreadyStarted -> ()
47
+ | _ -> failwithf " Azure Emulator Failure on start Storage Emulator"
42
48
)
43
49
44
50
/// Stops the compute emulator
0 commit comments