Skip to content

Commit

Permalink
Update Proc package and simplify binary execution logic
Browse files Browse the repository at this point in the history
Upgraded Proc package references from various older versions to 0.8.2 across multiple projects for consistency. Removed redundant overloaded method in `IClusterComposeTask.cs` to streamline the binary execution logic.
  • Loading branch information
Mpdreamz committed Oct 10, 2024
1 parent 34d6e3d commit 4e75ce9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build/scripts/scripts.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="Argu" Version="6.0.0" />
<PackageReference Include="Bullseye" Version="3.3.0" />
<PackageReference Include="Proc" Version="0.6.2" />
<PackageReference Include="Proc" Version="0.8.2" />
<PackageReference Include="Fake.Tools.Git" Version="5.15.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/ScratchPad/ScratchPad.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IsPackable>False</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Proc" Version="0.6.1" />
<PackageReference Include="Proc" Version="0.8.2" />
<!--<ProjectReference Include="..\..\..\..\..\proc\src\Proc\Proc.csproj" />-->
<PackageReference Include="NEST" Version="6.0.1" />
</ItemGroup>
Expand Down
12 changes: 3 additions & 9 deletions src/Elastic.Elasticsearch.Ephemeral/Tasks/IClusterComposeTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,10 @@ protected static void WriteFileIfNotExist(string fileLocation, string contents)

protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, params string[] arguments) =>
ExecuteBinaryInternal(config, writer, binary, description, null, arguments);

protected static void ExecuteBinary(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, StartedHandler startedHandler, params string[] arguments) =>
ExecuteBinaryInternal(config, writer, binary, description, startedHandler, arguments);
ExecuteBinaryInternal(config, writer, binary, description, arguments);

private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config, IConsoleLineHandler writer,
string binary, string description, StartedHandler startedHandler, params string[] arguments)
string binary, string description, params string[] arguments)
{
var command = $"{{{binary}}} {{{string.Join(" ", arguments)}}}";
writer?.WriteDiagnostic($"{{{nameof(ExecuteBinary)}}} starting process [{description}] {command}");
Expand All @@ -170,9 +166,7 @@ private static void ExecuteBinaryInternal(EphemeralClusterConfiguration config,
}
};

var result = startedHandler != null
? Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter(), startedHandler)
: Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter());
var result = Proc.Start(processStartArguments, timeout, new ConsoleOutColorWriter());

if (!result.Completed)
throw new Exception($"Timeout while executing {description} exceeded {timeout}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageTags>elastic,elasticsearch,cluster,observable,rx</PackageTags>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Proc" Version="0.6.1" />
<PackageReference Include="Proc" Version="0.8.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Elastic.Stack.ArtifactsApi\Elastic.Stack.ArtifactsApi.csproj" />
Expand Down

0 comments on commit 4e75ce9

Please sign in to comment.