Uses now JAVA_HOME Variable, First Background Test

This commit is contained in:
Matthias Spiegel 2023-03-25 23:49:35 +01:00
parent 2f18852fa5
commit a89eb4c854
2 changed files with 21 additions and 2 deletions

View file

@ -1,9 +1,27 @@
$basedir=(Get-Location) $basedir=(Get-Location)
$buildtools=$basedir.Path + "\..\.tools\buildtools" $buildtools=$basedir.Path + "\..\.tools\buildtools"
$version="1.19.4" $version="1.19.4"
$java=$env:JAVA_HOME
if ( $args.count -eq 0 ) {
Set-Location ($basedir.Path+"\server") Set-Location ($basedir.Path+"\server")
A:\scoop\apps\zulu-jdk\current\bin\java.exe -jar (".\spigot-"+$version+".jar") --nogui & $java\bin\java.exe -jar (".\spigot-"+$version+".jar") --nogui
}
elseif ($args[0] -eq "background") {
$serverProcess = New-Object System.Diagnostics.ProcessStartInfo;
$serverProcess.FileName = ($java + "\bin\java.exe"); #process file
$serverProcess.Arguments = ("-jar " + $basedir.Path + "\server\spigot-"+$version+".jar --nogui");
$serverProcess.WorkingDirectory = ($basedir.Path+"\server");
$serverProcess.UseShellExecute = $false; #start the process from it's own executable file
$serverProcess.RedirectStandardInput = $true; #enable the process to read from standard input
$p = [System.Diagnostics.Process]::Start($serverProcess);
Start-Sleep -s 50 #wait 2 seconds so that the process can be up and running
$p.StandardInput.WriteLine("stop"); #StandardInput property of the Process is a .NET StreamWriter object
}
Set-Location $basedir Set-Location $basedir

View file

@ -1,9 +1,10 @@
$basedir=(Get-Location) $basedir=(Get-Location)
$buildtools=$basedir.Path + "\..\.tools\buildtools" $buildtools=$basedir.Path + "\..\.tools\buildtools"
$version="1.19.4" $version="1.19.4"
$java=$env:JAVA_HOME
Set-Location $buildtools Set-Location $buildtools
A:\scoop\apps\zulu-jdk\current\bin\java.exe -jar .\BuildTools.jar --rev $version & $java\bin\java.exe -jar .\BuildTools.jar --rev $version
Set-Location $basedir Set-Location $basedir
Move-Item ($buildtools + "\spigot-" + $version + ".jar") .\server\. Move-Item ($buildtools + "\spigot-" + $version + ".jar") .\server\.