微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c#进程类访问被拒绝

如何解决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 举报,一经查实,本站将立刻删除。