- Home /
Get notification after shell script runs in build pipe
Hey Everybody!
So I'm having an issue with a build script that I've written. The script is fairly simple. It builds a linux version of my game and then calls an external script to pack it up and deploy it out into my dedicated server solution. Everything is great! However I don't seem to get any notification back from Unity when the shell process has exited. I can confirm the shell process is successfully exiting (I can see it come into existence do it's work and then leave) but I don't ever seem to get the notification that the process has ended. This is on MacOS. has anyone else gotten something like this working.
[MenuItem("Build/Build Server")]
public static void BuildLinuxServer () {
BuildPlayerOptions playerOptions = GetBuildOptions();
playerOptions.target = BuildTarget.StandaloneLinux64;
playerOptions.options = BuildOptions.EnableHeadlessMode;
playerOptions.locationPathName = "Build/Linux/GAME";
BuildGame(playerOptions);
Process uploadProcess = new Process();
uploadProcess.StartInfo.FileName = "Build/Linux/DeployCloud.sh";
// uploadProcess.StartInfo.FileName = "/bin/bash";
// Debug.Log(Application.dataPath + "/Builds/Linux/DeployCloud.sh");
// uploadProcess.StartInfo.Arguments = Application.dataPath + "/Builds/Linux/DeployCloud.sh";
// uploadProcess.StartInfo.UseShellExecute = false;
uploadProcess.StartInfo.Arguments = " && exit";
uploadProcess.EnableRaisingEvents = true;
if (!uploadProcess.Start())
UnityEngine.Debug.LogError(uploadProcess.StandardError.ReadToEnd());
else
uploadProcess.Exited += (sender, args) => Debug.Log("Server Code Uploaded");
}
I'm curious what type of notification you want? Something in the editor, a System Notification, an email? It really depends on your requirements. I typically use Jenkins to automate my builds. It's integrated with Slack so the $$anonymous$$m receives actionable notifications there (link to jenkins, hockeyapp/webgl build).
I don't really care about how it's presented I just never seem to receive uploadProcess.Exited. I'd be happy to just print it into the debug log. I just can't seem to figure out how to get C# to tell me when the process I'm starting exits.
I have build automation integrated later in the build pipe for distributed builds as well. This function is primarily used when I want to refresh and then kick the remote development environment. I just want to be able to print something out so that I know "okay the remote environment is now ready".
Oh, sorry I conflated something there. Have you tried using the WaitForExit
method?