Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved Getting return code from standalone player

Discussion in 'Testing & Automation' started by hassanbot, Sep 17, 2019.

  1. hassanbot

    hassanbot

    Joined:
    Sep 16, 2018
    Posts:
    9
    Hi!

    I'm trying to set up a CI pipeline for my project, and I'd like it to have one build step, and then another step where I make sure the finished build can start and run for a few seconds without errors. This is mainly a sanity test to make sure that it can start on an isolated machine (I'm using a Windows docker for this).

    I've made it so I can pass in a command line argument to make the application close down after a set amount of time, so it can be started something like this: UnityApp.exe -stopAfter 5 -batchmode -nographics

    The problem I'm having is that I don't know how to get the return code of the player. When I'm starting the application using the command prompt, the application immediately detaches and returns 0, while it continues to run as a background process. I'd like it to keep being attached to the command prompt so I can capture the return code when it exits.

    Anyone know if this can be done?

    Thanks,
    Martin
     
    Last edited: Sep 17, 2019
  2. hassanbot

    hassanbot

    Joined:
    Sep 16, 2018
    Posts:
    9
    Sorry, I'm stupid, it's a Windows thing. If you start the application from a .bat script it won't detach.