Skip to content

Commit

Permalink
feat: Change name and directory for MacOS stop script
Browse files Browse the repository at this point in the history
  • Loading branch information
Eptagone committed Jun 8, 2024
1 parent 8d9983c commit f877217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Vite.AspNetCore/Services/ViteDevServerLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private async Task StartViteDevServerIfNotRunningAsync()
}
else if (OperatingSystem.IsMacOS())
{
stopScriptLaunched = this.LaunchStopScriptForMacOs(this.process.Id);
stopScriptLaunched = LaunchStopScriptForMacOs(this.process.Id);
}

// If the stop script was not launched, log a warning.
Expand All @@ -194,12 +194,12 @@ private async Task StartViteDevServerIfNotRunningAsync()
/// </summary>
/// <param name="processId">The process ID.</param>
/// <returns>True if the script was launched successfully, otherwise false.</returns>
private bool LaunchStopScriptForMacOs(int processId)
private static bool LaunchStopScriptForMacOs(int processId)
{
// Define the script file name.
var fileName = Guid.NewGuid().ToString("N") + ".sh";
var fileName = "start-vite-dev-server.sh";
// Define the script path.
var scriptPath = Path.Combine(this.contentRootPath, fileName);
var scriptPath = Path.Combine(AppContext.BaseDirectory, fileName);
// Create the Bash script.
var stopScript =
@$"function list_child_processes () {{
Expand Down Expand Up @@ -237,7 +237,7 @@ private bool LaunchStopScriptForMacOs(int processId)
var stopScriptInfo = new ProcessStartInfo("/bin/bash", scriptPath)
{
CreateNoWindow = true,
WorkingDirectory = this.contentRootPath
WorkingDirectory = AppContext.BaseDirectory
};
// Start the process.
var stopProcess = Process.Start(stopScriptInfo);
Expand Down
2 changes: 1 addition & 1 deletion src/Vite.AspNetCore/Vite.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageTags>Vite;ViteJS;AspNet;MPA;Middleware;Server;Assets;Mvc;WebPages</PackageTags>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>2.0</Version>
<Version>2.0.1</Version>
<LangVersion>latest</LangVersion>
<PackageReleaseNotes></PackageReleaseNotes>
<AnalysisLevel>6.0-recommended</AnalysisLevel>
Expand Down

0 comments on commit f877217

Please sign in to comment.