From: Rony G. F. <Ron...@wu...> - 2023-08-04 11:14:44
|
On 04.08.2023 06:30, J Leslie Turriff wrote: > > On 2023-08-02 06:45:16 Rony G. Flatscher wrote: >> On 31.07.2023 16:27, Marc Remes wrote: >>> pipe 'command stty --all|console also runs fine.. Its output is empty >>> because it is not connected to a real/pseudo terminal, as echo dog |tty >>> reports. >>> >>> Indeed, we're not doing bash redirection, it is now java that is doing >>> the redirection. The command stage starts the stty process by r.exec and >>> connects to its stdin. For the stty process there's no difference whether >>> the redirection is done by bash or java, in both cases its stdin is not a >>> terminal. And thus stty has no effect. >> According to the JavaDocs for Process >> <https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html> "... By >> default, the created subprocess does not have its own terminal or console. >> ..." so this may be an explanation that stty would not find it and what >> Marc tries to point out. Not sure about ProcessBuilder >> <https://docs.oracle.com/javase/8/docs/api/java/lang/ProcessBuilder.html> >> can be used instead and making a difference? >> >> Maybe doing something like "stty -F `tty` --all" would work and if not > supplying explicitly the device path, if known? > You're a genius! It took several tries, and one has to know of a valid tty > to plug into the command, but yes, that's the key. > > I tried these in the jEdit console: > | ~> stty -F 'tty' --all > as you suggested, but stty seems to want to set tty attributes when it > sees -F; so I tried > | ~> stty --all -F 'tty' > but it said "stty: tty: No such file or directory" so I ran the w command to > find a "real" tty, and it seems like /dev/pts/## (where ## is any of the ttys > defined to the system) works, and the output from --all is not written to > that device, but to the console where stty was invoked! so we see something > like the attached output. The tty must belong to the account invoking stty > or we get "Permission denied". > > Thank you! Thank you! You are very welcome, glad that I could help a little bit. One more remark: have you tried the back-ticks ` around "tty"? E.g. in your example (that did not work) you write: stty --all -F 'tty' If you write it this way, would it work for you? echo `tty` stty --all -F `tty` ---rony |