c#进程类访问被拒绝

问题描述

我正在使用macOS Cataline 10.15.3。我正在开发一个Unity项目,并尝试合并Google的mediapipe。为此,我使用了C#的Process类,打开了一个进程并将其输出重定向到我的unity脚本。如果我有C代码,则可以将其编译为“ gcc code.c”,然后获得使用“ ./a.out”运行的可执行文件,而在c#中运行该代码代码将是

      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();

现在是compile.StartInfo.FileName,如果我转到代码文件,则不要转到可执行文件

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

我收到以下错误

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

拒绝访问

现在,mediapipe使用BAZEL。 我通过使用终端使用

导航到mediapipe目录来编译程序
bazel build -c opt --define MEDIAPIPE_disABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_out_cpu

我通过此命令运行程序

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

mediapipe目录中的主文件是BUILD文件,但这不是可执行文件。我不知道可执行文件是什么,或者它在哪里。

所以这是我能做的最好的

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";

我收到相同的ACCESS DENIED错误

所以我要么需要寻找BAZEL项目生成的可执行文件,要么需要找到一种在没有可执行文件的情况下在c#中运行程序的方法。我也找不到办法。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)