Skip to content

Commit

Permalink
Handle UI link
Browse files Browse the repository at this point in the history
  • Loading branch information
NullDev committed Oct 25, 2024
1 parent 68d20e6 commit 754eeb2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions StabilityMatrix.Core/Models/Packages/FluxGym.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Helper.Cache;
Expand Down Expand Up @@ -150,9 +150,28 @@ public override async Task RunPackage(
)
{
await SetupVenv(installLocation).ConfigureAwait(false);

void HandleConsoleOutput(ProcessOutput s)
{
onConsoleOutput?.Invoke(s);

if (s.Text.Contains("Running on local URL", StringComparison.OrdinalIgnoreCase))
{
var regex = new Regex(@"(https?:\/\/)([^:\s]+):(\d+)");
var match = regex.Match(s.Text);

if (match.Success)
{
Console.WriteLine($"AAAAAA {match.Value}");
WebUrl = match.Value;
}
OnStartupComplete(WebUrl);
}
}

VenvRunner.RunDetached(
[Path.Combine(installLocation, options.Command ?? LaunchCommand), ..options.Arguments],
onConsoleOutput,
HandleConsoleOutput,
OnExit
);
}
Expand Down

0 comments on commit 754eeb2

Please sign in to comment.