Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close stdin in asyncShellExec to avoid hangs #786

Merged
merged 1 commit into from
May 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/app/FakeLib/ProcessHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ let asyncShellExec (args : ExecParams) =
let commandLine = args.CommandLine + " " + formatArgs args.Args
let info =
ProcessStartInfo
(args.Program, UseShellExecute = false, RedirectStandardError = true, RedirectStandardOutput = true,
(args.Program, UseShellExecute = false,
RedirectStandardError = true, RedirectStandardOutput = true, RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden, WorkingDirectory = args.WorkingDirectory,
Arguments = commandLine)
use proc = new Process(StartInfo = info)
Expand All @@ -427,6 +428,7 @@ let asyncShellExec (args : ExecParams) =
start proc
proc.BeginOutputReadLine()
proc.BeginErrorReadLine()
proc.StandardInput.Close()
// attaches handler to Exited event, enables raising events, then awaits event
// the event gets triggered even if process has already finished
let! _ = Async.GuardedAwaitObservable proc.Exited (fun _ -> proc.EnableRaisingEvents <- true)
Expand Down