Closed Rinzwind closed 8 months ago
Hi @Rinzwind, @pavel-krivanek nice!
The build had a hiccup, I relaunched it. I see no objections to this.
It would be nice however to see some comments in the code. Maybe copy-pasting part of the PR description is enough?
I added a comment, fixed the compilation error on Linux (“error: implicit declaration of function 'ptsname'”), and improved the error checks in ‘tty_spawn’.
I’m not sure whether the library should be given a more distinct name. There’s an existing ‘libtty’.
Can this be merged? I had to make one more change (commit 6fa0c9e28884ae95) but I think it’s ready now. I wrote some tests for which I will open a Pharo pull request once ‘libtty’ is available in the VM.
This pull request adds a small library with a function to spawn a process connected to a pseudo-terminal. As discussed in pavel-krivanek/terminal issue #2 and PTerm issue #58, it’s not entirely possible to replicate this function in-image using
posix_spawn
. The function callssetsid
andioctl
withTIOCSCTTY
in the spawned process. For thesetsid
call, the attribute flagPOSIX_SPAWN_SETSID
can be passed toposix_spawn
(nonstandard but supported by the GNU C Library and macOS). But for theioctl
call there is, as far as I know, no corresponding attribute or file action that can be passed.The new File Browser that is being adopted (see: Pharo pull request #16084) offers a context menu item ‘Open terminal here’. That currently does not allow using PTerm (PTerm issue #62), but it would be nice if it did and if the VM made that convenient to use by providing the necessary supporting library.