swiftly
swiftly copied to clipboard
RunProgramError while running swiftly as the root user on macOS
When running swiftly init version 1.0.0 on macOS as the root user, there is the following error:
Error: RunProgramError(exitCode: 185, program: ".")
This is related to the following command that is run to detect the user's current shell:
"dscl", ".", "-read", FileManager.default.homeDirectoryForCurrentUser.path
That command fails with this error when run as root:
read: Invalid Path
<dscl_cmd> DS Error: -14009 (eDSUnknownNodeName)
When running as the root user, there will need to be some kind of fallback that doesn't error out the installation process. Also, the RunProgramError should report the correct program name (ie. not ".") for runProgramOutput().