Add files to an executable process from a library (dylib) in swift

Viewed 62

I'm trying to create a dynamic library (dylib) with some files inside that need to be sent in to an executable process in swift. To create the executable process I did this:

func boot() {
    let task = Process()
    task.launchPath = "/bin/bash"
    task.launchPath = Bundle.main.url(forResource: "boot", withExtension: "", subdirectory: "file/boot")?.path
    task.arguments = ["-f"]
    task.launch()
}

The problem is that after giving the task.arguments (with the related command), how do I send a file from a dynamic library to the process? How should I possibly structure the dynamic library to allow sending a file?

0 Answers
Related