Skip to content

Foundation.Process on Linux throws error Error Domain=NSCocoaErrorDomain Code=256 "(null)" if executable not found #4810

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

Open
weissi opened this issue Aug 15, 2023 · 1 comment
Assignees
Labels

Comments

@weissi
Copy link
Contributor

weissi commented Aug 15, 2023

When creating a Process with executableURL set to a file that doesn't exist, it throws

Error Domain=NSCocoaErrorDomain Code=256 "(null)"

which corresponds to an NSError with domain: NSCocoaErrorDomain (correct) and code: NSFileReadUnknownError (== 256`, incorrect).

Darwin systems have the correct

Error Domain=NSCocoaErrorDomain Code=4 "The file “exist” doesn’t exist." UserInfo={NSFilePath=/dev/null/does/not/exist}

which is code: NSFileNoSuchFileError (== 4).

@weissi weissi added the bug label Aug 15, 2023
@weissi
Copy link
Contributor Author

weissi commented Aug 15, 2023

Apple folk: This is rdar://113899085 .

@iCharlesHu iCharlesHu self-assigned this Sep 18, 2024
MaxDesiatov added a commit to swiftlang/swift-sdk-generator that referenced this issue Nov 27, 2024
Namely, this works around following issues in `Foundation.Process`:
 - "Foundation.Process on Linux throws error Error Domain=NSCocoaErrorDomain Code=256 "(null)" if executable not found"
   swiftlang/swift-corelibs-foundation#4810
 - "Foundation.Process on Linux doesn't correctly detect when child process dies (creating zombie processes)"
   swiftlang/swift-corelibs-foundation#4795
 - "Foundation.Process on Linux seems to inherit the Process.run()-calling thread's signal mask, even SIGTERM blocked"
   swiftlang/swift-corelibs-foundation#4772
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants