From: J L. T. <jlt...@ma...> - 2023-08-04 04:30:51
|
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! Leslie > > --- > > In ooRexx it works as expected, i.e. > > cmd="stty --all" > cmd > > -- or redirecting > arr=.array~new > address system cmd with output using (arr) > say 'arr~items:' arr~items > say arr > > ---rony > > > On 7/31/23 16:00, J Leslie Turriff wrote: > >> On 2023-07-31 06:20:50 Marc Remes wrote: > >>> On 7/31/23 13:03, Rony G. Flatscher wrote: > >>>> According to "https://linux.die.net/man/1/stty" "stty --all" would > >>>> print all settings (to stdout I assume). > >>> > >>> True : > >>> > >>> $ stty --all > >>> speed 38400 baud; rows 30; columns 99; line = 0; > >>> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; > >>> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; > >>> rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; > >>> -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts > >>> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon > >>> -ixoff -iuclc -ixany -imaxbel iutf8 > >>> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 > >>> vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase > >>> -tostop -echoprt echoctl echoke -flusho -extproc > >>> $ echo dog | stty > >>> stty: 'standard input': Inappropriate ioctl for device > >>> > >>> The first command is attached to a terminal (either a 'real' terminal, > >>> but more likely a pseudo-terminal), and shows its settings. The second > >>> command's stdin is the stdout of the echo command, and says so.. > >>> > >>> Also check the tty command: > >>> $ tty > >>> /dev/pts/6 > >>> $ echo dog | tty > >>> not a tty > >>> > >>> Marc > >> > >> But: > >> | @08:49:08 leslie@pinto > >> | wd=~/bin/NetRexx/Pipelines > >> | $ pipe 'command ls -l|console' > >> | total 224 > >> | -rw-r--r-- 1 leslie users 3741 Jun 29 01:44 condense.class > >> | -rw-r--r-- 1 leslie users 1298 Jun 29 00:07 GenSymLinks.class > >> | -rw-r--r-- 1 leslie users 4688 Jun 28 23:53 > >> | GenSymLinks_gensymlinks.class : > >> | -rw-r--r-- 1 leslie users 2403 Jun 19 15:50 treeOutput.txt > >> | rc=0 > >> > >> works just fine, whereas > >> > >> | @08:49:20 ─▶leslie@pinto◀─ > >> | wd=~/bin/NetRexx/Pipelines > >> | $ pipe 'command stty --all|console' > >> | rc=0 > >> > >> produces no output. What is the difference between the stage "command > >> ls -l" (which works) and "command stty --all" (which does not)? We're > >> not doing bash redirection here; this is inside the NetRexx pipeline. > >> > >> Leslie |