Hi Quinn.
Thank you very much for reply. As far as I can understand of the new Subprocess, I belive that is the answer to my question.. Looking forward to the release...
Post
Replies
Boosts
Views
Activity
Tried to change the run as advised p.executableURL = URL(fileURLWithPath: "/usr/bin/rsync"), enabled Sandbox and granted the app Full Disc Access.. Still /usr/bin/rsync throws an error : rsync: execv/us/libexec/rsync/rsync.samba): Operation not permitted .. without Sandbox the rsync version show: rsync version 2.6.9 protocol version 29...
Thx, I will try to use the URL.. My code look like this. The task.launchpath = /usr/bin/rsync... Will try to replace as you advice...
func executeProcess() async {
// Must check valid rsync exists
guard SharedReference.shared.norsync == false else { return }
// Process
let task = Process()
// Getting version of rsync
task.launchPath = GetfullpathforRsync().rsyncpath
task.arguments = arguments
// Pipe for reading output from Process
let pipe = Pipe()
task.standardOutput = pipe
task.standardError = pipe
let outHandle = pipe.fileHandleForReading
outHandle.waitForDataInBackgroundAndNotify()
// Combine, subscribe to NSNotification.Name.NSFileHandleDataAvailable
NotificationCenter.default.publisher(
for: NSNotification.Name.NSFileHandleDataAvailable)
.sink { _ in
let data = outHandle.availableData
if data.count > 0 {
if let str = NSString(data: data, encoding: String.Encoding.utf8.rawValue) {
self.outputprocess?.addlinefromoutput(str: str as String)
}
outHandle.waitForDataInBackgroundAndNotify()
}
}.store(in: &subscriptons)
// Combine, subscribe to Process.didTerminateNotification
NotificationCenter.default.publisher(
for: Process.didTerminateNotification)
.debounce(for: .milliseconds(500), scheduler: globalMainQueue)
.sink { _ in
// Process termination and Log to file
self.processtermination(self.outputprocess?.getOutput(), self.config?.hiddenID)
_ = Logfile(TrimTwo(self.outputprocess?.getOutput() ?? []).trimmeddata, error: false)
// Release Combine subscribers
self.subscriptons.removeAll()
}.store(in: &subscriptons)
SharedReference.shared.process = task
do {
try task.run()
} catch let e {
let error = e
propogateerror(error: error)
}
if let launchPath = task.launchPath, let arguments = task.arguments {
Logger.process.info("RsyncProcessAsync: \(launchPath, privacy: .public)")
Logger.process.info("RsyncProcessAsync: \(arguments.joined(separator: "\n"), privacy: .public)")
}
}
In language settings there is a possibility to choose language on a app basis.. And on RsyncUI German is set to be the system default language on a English setup of MacOS Monterey. The development language is English...
Anyone has some idea what is going wrong?