-
Notifications
You must be signed in to change notification settings - Fork 65
Description
I am not sure if this is due to having something configured incorrectly, but I am getting an error when running a Swift script with sudo, while Swiftly is installed. This is preventing me from running some of our Swift scripts that require sudo.
I ran the install script from here and selected the defaults. Swiftly is installed in my user directory and I have a global toolchain set.
Any help on what I may have done wrong here, or what I'm missing, is much appreciated.
To recreate the issue I created a simple script called test.swift
#!/usr/bin/env swift
import Foundation
print("Hello!")If I run the swift script using ./test.swift then it runs correctly. However, if I use sudo ./test.swift, then it fails.
Could not load swiftly's configuration file at /var/root/.swiftly/config.json.
To begin using swiftly you can install it: 'swift init'.
I then created another shell script called test.sh
#!/bin/bash
echo "Hello"Running the test.sh script has no issues, even when adding sudo.