Repository navigation
Conversation
Fixes #13319 AppKit treats existing positional arguments as documents, causing paths passed to a child command after -e to open an extra terminal surface. We now process args ourselves during openFile callbacks to ignore file paths after `-e`. There isn't a way to avoid this I can find because AppKit processes argc/argv from the main entrypoint and that can't be overridden.
| fileExists: { existing.contains($0) } | ||
| ) | ||
|
|
||
| #expect(!filter.shouldIgnore("/tmp/before.txt")) |
There was a problem hiding this comment.
Btw this is intentional right now. I couldn't find evidence in any terminal really how this should be handled. I think its harmless.
| /// `-e`. Each matching event is consumed once so later requests to open the same | ||
| /// file are handled normally. | ||
| final class CommandLineOpenFileFilter { | ||
| private let workingDirectory: String |
There was a problem hiding this comment.
I think this is fine, but we should also consider using the URL-based file system paths more often.
There was a problem hiding this comment.
Makes sense generally. Since the surrounding AppKit and FileManager APIs use path strings here, I’d prefer to keep this change as-is. I don't think URL buys us anything?
There was a problem hiding this comment.
Not in this case because the inputs are already String, but the working directory could be a URL with internal conversion. (This is already doing as NSString to get the to older NSString-based path routines that are no longer available on String and have moved to URL.)
Fixes #13319
AppKit treats existing positional arguments as documents, causing paths passed to a child command after -e to open an extra terminal surface.
We now process args ourselves during openFile callbacks to ignore file paths after
-e. There isn't a way to avoid this I can find because AppKit processes argc/argv from the main entrypoint and that can't be overridden.