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

Bug Running bash shell script not working in Hub 3.0

Discussion in 'Unity Hub' started by kkl888, Jan 17, 2022.

  1. kkl888

    kkl888

    Joined:
    Dec 6, 2014
    Posts:
    52
    The following code to run bash script seems not working with Unity Hub 3.0 in Mac OSX.
    Code (CSharp):
    1.      System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
    2.      startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    3.      startInfo.FileName = "/bin/bash";
    4.      startInfo.Arguments = "-c \"p4 change counter\"";
    5.      startInfo.RedirectStandardOutput = true;
    6.      startInfo.UseShellExecute = false;
    7.      System.Diagnostics.Process process = new System.Diagnostics.Process();
    8.      process.StartInfo = startInfo;
    9.      process.Start();
    It says "p4 command not found". I suspect the new Unity Hub starts Unity Editor without including the local bash profile. The same code used to work on Unity Hub 2.4.5, on exactly the same machine.
     
  2. DarekRusin

    DarekRusin

    Joined:
    Nov 15, 2013
    Posts:
    47
  3. kkl888

    kkl888

    Joined:
    Dec 6, 2014
    Posts:
    52
    Looks like same issue =(. Since Unity Hub v3 no longer includes the env and path, I fixed it with this temporary solution, by specifying the absolute path for that particular command.

    Change from
    Code (CSharp):
    1. startInfo.Arguments = "-c \"p4 change counter\"";
    to
    Code (CSharp):
    1. startInfo.Arguments = "-c \"/usr/local/bin/p4 change counter\"";