c# Process Class Access Denied

197 views Asked by At

I am working on macOS Cataline 10.15.3. I am working on a Unity Project and I tried to incorporate Google's mediapipe .For this I used the Process class of C#, opened a process and redirected it's output to my unity script. If I have a C code I can compile it "gcc code.c" and then I have the executable which is run using "./a.out", and the code for running this in c# would be

      Process compiler = new Process() ;
      compiler.StartInfo.FileName = "PATH/a.out";
      compiler.StartInfo.Arguments = "./a.out ";
      compiler.StartInfo.UseShellExecute = false;
      compiler.StartInfo.RedirectStandardOutput = true;
      compiler.Start();
      UnityEngine.Debug.Log(compiler.StandardOutput.ReadToEnd());
      compiler.WaitForExit();

Now for compiler.StartInfo.FileName, instead of going to the executable if I go to the code file

compiler.StartInfo.FileName = "PATH/writer.cc";

I get the following error

ApplicationName='PATH/writer.cc', CommandLine='./a.out ', CurrentDirectory='', Native error= Access denied

ACCESS DENIED

Now, mediapipe uses BAZEL. I compile the program by navigating into the mediapipe directory using terminal using

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_out_cpu

I run the program by this command

bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_out_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt

The main file in the mediapipe directory is the BUILD file, but that's not the executable. I don't know what the executable is or where it is.

so this is the best that I can do

compiler.StartInfo.FileName = "PATH/BUILD";
compiler.StartInfo.Arguments = "bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_out_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt";

I get the same ACCESS DENIED error

So either I need to look for the executable which BAZEL projects produce, or I need to find a way to run programs in c# without the executable. I found no way to do either.

0

There are 0 answers