-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.ps1
40 lines (31 loc) · 1.11 KB
/
run.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Start the Java application
$process = Start-Process -FilePath "java" -ArgumentList "-jar target\delorean-1.0.0.jar" -NoNewWindow -PassThru -RedirectStandardInput -RedirectStandardOutput
# Wait for the application to be ready for the next command
function WaitForPrompt {
param (
[string]$prompt = '>'
)
while ($true) {
$output = $process.StandardOutput.ReadLine()
if ($output -like "*$prompt*") {
break
}
Write-Host $output
}
}
# Send commands and wait for the application to process each one
$process.StandardInput.WriteLine("new a5_1_1")
WaitForPrompt
$process.StandardInput.WriteLine("xml_config - a5_1_1")
WaitForPrompt
$process.StandardInput.WriteLine("db_config - a5_1_1")
WaitForPrompt
$process.StandardInput.WriteLine("xml - load C:\Users\rapha\Documents\project\delorean\src\main\resources\a5_1_1\a5_1_1_dataset.xml")
WaitForPrompt
$process.StandardInput.WriteLine("db - startup")
WaitForPrompt
$process.StandardInput.WriteLine("db - load")
WaitForPrompt
$process.StandardInput.WriteLine("exit")
# Wait for the process to exit
$process.WaitForExit()