Threadsafe please
This commit is contained in:
32
utils.go
32
utils.go
@@ -85,14 +85,13 @@ func GenerateUnrealSolution(project Project) {
|
||||
cmd = exec.Command(buildCmd, projectFile, "-game")
|
||||
|
||||
case "windows":
|
||||
editor := project.EnginePath + "\\Engine\\Binaries\\Win64\\UnrealEditor.exe"
|
||||
ubtPath := project.EnginePath + "\\Engine\\Binaries\\DotNET\\UnrealBuildTool\\UnrealBuildTool.dll"
|
||||
cmd = exec.Command(
|
||||
editor,
|
||||
projectFile,
|
||||
"dotnet", ubtPath,
|
||||
"-projectfiles",
|
||||
"-project="+projectFile,
|
||||
"-game",
|
||||
"-progress",
|
||||
"-waitmutex",
|
||||
"-NoHotReloadFromIDE",
|
||||
)
|
||||
|
||||
default:
|
||||
@@ -167,18 +166,27 @@ func logToOutput(cmd *exec.Cmd) {
|
||||
fmt.Println("Error while loading command")
|
||||
}
|
||||
|
||||
readPipe := func(reader io.ReadCloser) {
|
||||
readPipe := func(reader io.ReadCloser, prefix string) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
Log(line)
|
||||
if prefix != "" {
|
||||
Log(prefix + line)
|
||||
} else {
|
||||
Log(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
go readPipe(stdout)
|
||||
go readPipe(stderr)
|
||||
go readPipe(stdout, "")
|
||||
go readPipe(stderr, "[ERR] ")
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
fmt.Println("Error")
|
||||
}
|
||||
// attendre la fin dans une goroutine => pas de blocage de l'UI
|
||||
go func() {
|
||||
if err := cmd.Wait(); err != nil {
|
||||
Log("[FAIL] " + err.Error())
|
||||
} else {
|
||||
Log("[DONE] Process finished")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user