swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

RunProgramError while running swiftly as the root user on macOS

Open cmcgee1024 opened this issue 7 months ago • 0 comments

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().

cmcgee1024 avatar May 08 '25 14:05 cmcgee1024