X-Received: by 2002:aed:2050:: with SMTP id 74mr4137957qta.217.1581714134954; Fri, 14 Feb 2020 13:02:14 -0800 (PST) X-Received: by 2002:a25:a444:: with SMTP id f62mr4656943ybi.235.1581714134666; Fri, 14 Feb 2020 13:02:14 -0800 (PST) Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Fri, 14 Feb 2020 13:02:14 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=24.107.176.41; posting-account=G1KGwgkAAAAyw4z0LxHH0fja6wAbo7Cz NNTP-Posting-Host: 24.107.176.41 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8f61cfbe-6666-4a4a-b328-bb51016973da@googlegroups.com> Subject: Re: running java kills parent shell From: luserdroog Injection-Date: Fri, 14 Feb 2020 21:02:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Lines: 71 Xref: csiph.com comp.lang.java.programmer:39296 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: >=20 > >=20 > > 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=20 > tried piping the Java output into 'od': >=20 > java HelloWorld | od -t x1 >=20 > Which should show something like: >=20 > 0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 0a >=20 > IOW, "Hello World" as a list of the hexadecimal character values=20 > terminated by LF. That should, at least show if any control characters=20 > are appended to the string. >=20 > I actually ran: =20 >=20 > echo "Hello, World" | od -t x1 >=20 > which produced the line shown above. The initial 0000000 (the offset of= =20 > the first character) followed by a line containing 0000015 (the offset of= =20 > the start of the next line in octal notation. Makes me feel old - the=20 > last time I routinely used octal was writing assembler on ICL 1900=20 > mainframes. > =20 Good idea. This gives some interesting output. =1B]0;~/cs4500/hw2=07 luser@LAPTOP-K627HB8A ~/cs4500/hw2 $ echo | java HelloWorld Hello, World =1B]0;~/cs4500/hw2=07 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 =1B]0;~/cs4500/hw2=07 luser@LAPTOP-K627HB8A ~/cs4500/hw2 $ exit Process shell finished =1B]0;~/cs4500/hw2=07 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 =1B]0;~/cs4500/hw2=07 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 =1B]0;~/cs4500/hw2=07 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.