Skip to content

Commit

Permalink
Fix compiling
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Dec 23, 2024
1 parent 9a974fa commit df614a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config,
var timeout = TimeSpan.FromSeconds(420);
var processStartArguments = new StartArguments(binary, arguments)
{
Environment = environment
Environment = environment,
Timeout = timeout,
ConsoleOutWriter = new ConsoleOutWriter()
};

var result = Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter());
var result = Proc.Start(processStartArguments);

if (!result.Completed)
throw new Exception($"Timeout while executing {description} exceeded {timeout}");
Expand Down
15 changes: 9 additions & 6 deletions build/scripts/Tooling.fs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ module Tooling =

let private defaultConsoleWriter = Some <| (ConsoleOutColorWriter() :> IConsoleOutWriter)

let readInWithTimeout timeout workinDir bin (writer: IConsoleOutWriter option) args =
let readInWithTimeout (timeout: TimeSpan) workinDir bin (writer: IConsoleOutWriter option) args =
let startArgs = StartArguments(bin, args |> List.toArray)
if (Option.isSome workinDir) then
startArgs.WorkingDirectory <- Option.defaultValue "" workinDir
let result = Proc.Start(startArgs, timeout, Option.defaultValue<IConsoleOutWriter> (NoopWriter()) writer)
startArgs.Timeout <- timeout
startArgs.ConsoleOutWriter <- Option.defaultValue<IConsoleOutWriter> (NoopWriter()) writer
let result = Proc.Start(startArgs)

if not result.Completed then failwithf "process failed to complete within %O: %s" timeout bin
if not result.ExitCode.HasValue then failwithf "process yielded no exit code: %s" bin
Expand All @@ -57,16 +59,17 @@ module Tooling =
let read bin args = readInWithTimeout defaultTimeout None bin defaultConsoleWriter args
let readQuiet bin args = readInWithTimeout defaultTimeout None bin None args

let execInWithTimeout timeout workinDir bin args =
let execInWithTimeout (timeout: TimeSpan) workinDir bin args =
let startArgs = ExecArguments(bin, args |> List.toArray)
if (Option.isSome workinDir) then
startArgs.WorkingDirectory <- Option.defaultValue "" workinDir
startArgs.Timeout <- timeout
let options = args |> String.concat " "
printfn ":: Running command: %s %s" bin options
let result = Proc.Exec(startArgs, timeout)
try
if not result.HasValue || result.Value > 0 then
failwithf "process returned %i: %s" result.Value bin
let result = Proc.Exec(startArgs)
if result > 0 then
failwithf "process returned %i: %s" result bin
with
| :? ProcExecException as ex -> failwithf "%s" ex.Message

Expand Down

0 comments on commit df614a7

Please sign in to comment.