question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better way to wait for build and check exit code

See original GitHub issue

From here:

https://github.com/Dinomite-Studios/unity-azure-pipelines-tasks/blob/4a64eda5de819563cb17d3a4da7e1cfdc6a30d2d/Tasks/UnityBuild/UnityBuildV2/unity-build.ts#L83-L94

I suggest replacing it with a far simpler way:

start “Unity build” /wait “C:\Program Files\Unity\Editor\Unity.exe” -batchmode -buildTarget standalone -projectPath .\src\UnitProject -logfile editor.log -quit

The cmd.exe command start /wait will not exit until the process you started exits, and it propagates the exit code of that process back to the caller, allowing the Pipeline to fail with an error. Also, the -quit switch ensures that unity.exe exits when the build is done.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
milsoftcommented, Mar 26, 2019

@AArnott @FejZa consider wrapping the execution in a powershell job. Look at the documentation for Start-Job Get-Job and Wait-Job. You can also get status of things this way, and there are ways to dig deep to get child processes spawned by the jobs.

0reactions
FejZacommented, Apr 22, 2020

Fixed in v2.7

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to wait in bash for several subprocesses to finish, and ...
#!/usr/bin/env bash # Wait for pids to terminate. If one pid exits with # a non zero exit code, send the TERM signal...
Read more >
wait for process in pipeline returns wrong exit code
The way to get the behaviour I want is to use a temporary file to capture exit codes from within the asynchronous code....
Read more >
How to Fix 'Terminated With Exit Code 1' Error - Komodor
Check if a file listed in the image specification was not found. · In Docker, use the docker stop command to stop the...
Read more >
Bash command line exit codes demystified | Enable Sysadmin
The best method for script debugging with this exit status is to issue your command in an interactive shell to see the errors...
Read more >
A Guide to System.exit() - Baeldung
exit method suit better for script-based applications or wherever the status codes are interpreted. You can check out the examples provided in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found