Skip to content

Commit

Permalink
Content/build.fsx: use CreateProcess (#32)
Browse files Browse the repository at this point in the history
Use CreateProcess instead of Process.start
  • Loading branch information
dharmatech authored Feb 19, 2021
1 parent 6ede213 commit 691b671
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Content/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ open Fake.DotNet
open Fake.IO
open System.Threading

open System.Runtime.InteropServices

let appPath = "./src/SaturnServer/" |> Path.getFullName
let projectPath = Path.combine appPath "SaturnServer.fsproj"

Expand All @@ -27,7 +29,13 @@ Target.create "Run" (fun _ ->
}
let browser = async {
Thread.Sleep 5000
Process.start (fun i -> { i with FileName = "http://localhost:8085" }) |> ignore

if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then
CreateProcess.fromRawCommand "cmd.exe" [ "/C"; "start http://localhost:8085" ] |> Proc.run |> ignore
elif RuntimeInformation.IsOSPlatform(OSPlatform.Linux) then
CreateProcess.fromRawCommand "xdg-open" [ "http://localhost:8085" ] |> Proc.run |> ignore
elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then
CreateProcess.fromRawCommand "open" [ "http://localhost:8085" ] |> Proc.run |> ignore
}

[ server; browser]
Expand Down

0 comments on commit 691b671

Please sign in to comment.