"Could not find a part of the path '/dev/fd/13'" when I run my app in the root directory

Hello. I’m making an app for the execution of customer code. As part of this requirement, I want to run my agent in the root of the created VM.

I’ve created an app from the following Dockerfile:

FROM vasil2000yanakiev/act:latest as agent

FROM mcr.microsoft.com/devcontainers/typescript-node

COPY --from=agent /Agent /Agent
WORKDIR /
CMD [""sudo"", ""/Agent""]"

However, when I pass “/” to the below code:

private static FileSystemNode ScanDirectory(string path)
  {
      var dirInfo = new DirectoryInfo(path);
      var node = new FileSystemNode(dirInfo.Name, []);

      // Add all files
      foreach (var file in dirInfo.GetFiles())
      {
          node.Children!.Add(new FileSystemNode(file.Name));
      }

      // Recursively add all subdirectories
      foreach (var dir in dirInfo.GetDirectories())
      {
          node.Children!.Add(ScanDirectory(dir.FullName));
      }

      return node;
  }

public record FileSystemNode(string Name, List<FileSystemNode>? Children=null);

I get the following exception: “Could not find a part of the path ‘/dev/fd/13’”.

Searching online, I’ve stumbled on a lot of errors that look similar: Google Search , but I haven’t been able to fix the issue.

Do you actually need to list everything in /dev? I would regard that as not fully traversable on any Linux system, so I’d just add an exception to your recursion, so that /dev is not explored.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.