Thanks
First, and foremost, thanks for pty4j, it is a very useful lib!
Disclaimer
My understanding is just that and could be wrong.
I am happy to learn if/where I've gone astray.
Use Case
I am contributing to an experimental open-source terminal that uses pty4j.
On macOS, due to the way Apple implemented shell initialization, it seems it is best practice to launch the shell for a terminal as a login shell.
This can be done via:
- specifying an
-l or --login option to bash
- overriding
argv[0] with a - prefix. For example, launching /bin/bash results in overriding argv[0] from /bin/bash to -bash.
We looked at kitty, alacritty, iTerm2 and contour. They all picked option 2.
So we'd like to do the same.
Issue
While I do see pty4j has an exec method in com.pty4j.unix.PtyHelpers that looks like it would allow me to override argv[0] via its argv parameter, using it directly seems to mean I would lose the benefits of com.pty4j.unix.UnixPtyProcess.
Proposal
Make it easier to override argv[0].
Here are some initial ideas:
- For me, ideally, this would be via a new option in one/more of the
exec methods in com.pty4j.PtyProcess. Perhaps something named argv0Override? I don't think this is valid for Windows, so on that OS, if specified, it could be ignored (or throw, whatever makes sense).
- Another alternative that might be workable is making
exec in com/pty4j.unix.UnixPtyProcess public and override-able. This, I think, would allow me to replace exec behaviour to do my argv[0] override bidding.
- ?? Does anyone else see another good option I am missing?
Next steps
If this makes sense and is of interest, I could take a crack at a PR after we agree on an approach.
Thanks
First, and foremost, thanks for pty4j, it is a very useful lib!
Disclaimer
My understanding is just that and could be wrong.
I am happy to learn if/where I've gone astray.
Use Case
I am contributing to an experimental open-source terminal that uses pty4j.
On macOS, due to the way Apple implemented shell initialization, it seems it is best practice to launch the shell for a terminal as a login shell.
This can be done via:
-lor--loginoption to bashargv[0]with a-prefix. For example, launching/bin/bashresults in overridingargv[0]from/bin/bashto-bash.We looked at kitty, alacritty, iTerm2 and contour. They all picked option 2.
So we'd like to do the same.
Issue
While I do see pty4j has an exec method in com.pty4j.unix.PtyHelpers that looks like it would allow me to override
argv[0]via itsargvparameter, using it directly seems to mean I would lose the benefits ofcom.pty4j.unix.UnixPtyProcess.Proposal
Make it easier to override
argv[0].Here are some initial ideas:
execmethods incom.pty4j.PtyProcess. Perhaps something namedargv0Override? I don't think this is valid for Windows, so on that OS, if specified, it could be ignored (or throw, whatever makes sense).execincom/pty4j.unix.UnixPtyProcesspublic and override-able. This, I think, would allow me to replaceexecbehaviour to do myargv[0]override bidding.Next steps
If this makes sense and is of interest, I could take a crack at a PR after we agree on an approach.