August Feng

Learning how to make procesess

About

Let's learn how to make some processes in FSharp in the most simplest way!

  open System.Diagnostics

  let makeProcess exe args =
      let startInfo = new ProcessStartInfo(
        fileName = exe,
        Arguments = String.concat " " args
      )
      new Process(StartInfo = startInfo)

  let run (proc : Process) =
      proc.Start() |> ignore
      proc.WaitForExit()

  [<EntryPoint>]
  let main _ =
      use proc = makeProcess "echo" ["helloworld"]
      run proc
      0