Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: The operation couldn’t be completed. (NSPOSIXErrorDomain.13) #191

Open
chrispix opened this issue Jan 10, 2023 · 6 comments
Open

Comments

@chrispix
Copy link

I consistently get this trying to run even a trivial script like the following. Running it without the sh works fine. swift-sh 2.4.0 is installed. I'm running Swift 5.7.2 on a M1 Mac with macOS 12.6.1. Not really sure how to troubleshoot further.

#!/usr/bin/swift sh

print("foo")
@mxcl
Copy link
Owner

mxcl commented Jan 15, 2023

how'd you install swift sh?

@chrispix
Copy link
Author

brew install swift-sh

❯ which swift-sh
/opt/homebrew/bin/swift-sh

@mxcl
Copy link
Owner

mxcl commented Jan 18, 2023

Thanks for the report, I really don’t have time to debug this and nothing comes to mind. It could be Swift 5.7 doesn't work. /cc @wti

@wti
Copy link
Collaborator

wti commented Jan 22, 2023

Your script works for me on Intel macOS 13.1 with Swift 5.7.1 installed via homebrew. I also tried #!/usr/bin/env swift-sh.

To isolate and make a reproducible case, you could start by cloning the project and running the tests

git clone https://github.com/mxcl/swift-sh.git
swift test

@chrispix
Copy link
Author

Well this is kind of crazy, but it seems to be a side effect of the directory I was running it from. I did the following:

  1. Cloned swift-sh, ran tests. Success.
  2. In that directory, created my test script, ran it. Success.
  3. Went back to directory I was in when I reported the issue (~/Downloads), ran my test script. Failed.
  4. Copied that test script to my home directory, ran it. Success.
  5. Copied the test script from step 1 to ~/Downloads, ran it. Failed.

So I'll keep playing around to see if the problem arises again. If getting to the bottom of this is something you want to pursue, I'm happy to run additional tests.

@mxcl
Copy link
Owner

mxcl commented Jan 24, 2023

K this is a bug in that the CWD shouldn't cause failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants