Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39296

Re: running java kills parent shell

Newsgroups comp.lang.java.programmer
Date 2020-02-14 13:02 -0800
References <c7b42f97-07e8-4899-85e5-a81153e140b4@googlegroups.com> <r20q9s$5gt$1@dont-email.me> <fe3df469-89b4-4dcd-808e-714891134802@googlegroups.com> <r270q4$st0$1@dont-email.me>
Message-ID <8f61cfbe-6666-4a4a-b328-bb51016973da@googlegroups.com> (permalink)
Subject Re: running java kills parent shell
From luserdroog <luser.droog@gmail.com>

Show all headers | View raw


On Friday, February 14, 2020 at 2:43:57 PM UTC-6, Martin Gregorie wrote:
> On Fri, 14 Feb 2020 10:53:46 -0800, luserdroog wrote:
> 
> > 
> > So I guess it's something weird that the Emacs terminal is doing, and
> > not bash per se.
> >
> Seems possible. Have you looked at the string returned by Scanner or 
> tried piping the Java output into 'od':
> 
> java HelloWorld | od -t x1
> 
> Which should show something like:
> 
> 0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 0a
> 
> IOW, "Hello World" as a list of the hexadecimal character values 
> terminated by LF. That should, at least show if any control characters 
> are appended to the string.
> 
> I actually ran:  
> 
> echo "Hello, World" | od -t x1
> 
> which produced the line shown above. The initial 0000000 (the offset of 
> the first character) followed by a line containing 0000015 (the offset of 
> the start of the next line in octal notation. Makes me feel old - the 
> last time I routinely used octal was writing assembler on ICL 1900 
> mainframes.
>  

Good idea. This gives some interesting output.

]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$ echo | java HelloWorld
Hello, World
]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$ java HelloWorld | od -t x1

0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 0d 0a
0000016
]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$ exit

Process shell finished
]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$ echo | java HelloWorld | od -t x1
0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 0d 0a
0000016
]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$ echo Hello, World | od -t x1
0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 0a
0000015
]0;~/cs4500/hw2
luser@LAPTOP-K627HB8A ~/cs4500/hw2
$

Feeding in the Return key with echo makes it not kill the shell.
And the other outputs show a CR LF pair. Whereas just echoing
the string shows a bare LF. I wonder if it's a clash between
the line ending expected/provided by the 'java' executable
and the shell. My current guess is that 'java' is expecting
a CR LF on stdin, but only receiving a CR and then forcibly
consuming an extra byte somehow which is confusing the Emacs
terminal.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

running java kills parent shell luserdroog <luser.droog@gmail.com> - 2020-02-11 19:57 -0800
  Re: running java kills parent shell Martin Gregorie <martin@mydomain.invalid> - 2020-02-12 12:15 +0000
    Re: running java kills parent shell luserdroog <luser.droog@gmail.com> - 2020-02-14 10:53 -0800
      Re: running java kills parent shell Martin Gregorie <martin@mydomain.invalid> - 2020-02-14 20:43 +0000
        Re: running java kills parent shell luserdroog <luser.droog@gmail.com> - 2020-02-14 13:02 -0800
          Re: running java kills parent shell Martin Gregorie <martin@mydomain.invalid> - 2020-02-14 21:46 +0000
            Re: running java kills parent shell Arne Vajhøj <arne@vajhoej.dk> - 2020-02-14 19:39 -0500

csiph-web