causing bash to logout problem - Linux
This is a discussion on causing bash to logout problem - Linux ; Hello,
I have a utility that I have written. Occasionally it causes bash to
log out, apparently just as the program ends. I thought perhaps it
could be printing a control character like ^D, but have tried some
tests which ...
-
causing bash to logout problem
Hello,
I have a utility that I have written. Occasionally it causes bash to
log out, apparently just as the program ends. I thought perhaps it
could be printing a control character like ^D, but have tried some
tests which print various combinations of characters out and i can't
replicate this behaviour. Does anyone know how I might be causing bash
to logout from my program? Any help would be really appreciated 
Thanks,
James
-
Re: causing bash to logout problem
jim wrote:
> I have a utility that I have written. Occasionally it causes bash to
> log out, apparently just as the program ends. I thought perhaps it
> could be printing a control character like ^D, but have tried some
> tests which print various combinations of characters out and i can't
> replicate this behaviour. Does anyone know how I might be causing bash
> to logout from my program? Any help would be really appreciated 
>
kill(getppid(), SIGKILL);
I supect you wouldn't do that by accident...
-
Re: causing bash to logout problem
> kill(getppid(), SIGKILL);
lol No, not got that line. Anyway, that would only kill the application
and not bash. Is there some way that the terminal can send an escape
sequence to the host. For example, if using a vt100 like terminal,
typing
bash# echo "^[[cJIM"
gives you
JIM
bash# 1;2c
Because the echoed string is interpretted by the terminal, which sends
back it's terminal identifier sequence to the host. Is there some what
the the terminal could be made to send the ^D control sequence?
Cheers,
Jim
-
Re: causing bash to logout problem
jim wrote:
>> kill(getppid(), SIGKILL);
>
> lol No, not got that line. Anyway, that would only kill the application
> and not bash.
Note the getppid(), not getpid().
> Is there some way that the terminal can send an escape
> sequence to the host. For example, if using a vt100 like terminal,
> typing
> bash# echo "^[[cJIM"
> gives you
> JIM
> bash# 1;2c
> Because the echoed string is interpretted by the terminal, which sends
> back it's terminal identifier sequence to the host. Is there some what
> the the terminal could be made to send the ^D control sequence?
Remember that "exit" will also cause an exit.
Another possiblity I've encountered in the past is a program that sets
the terminal to nodelay reading and crashes without fixing it then the
shell gets EOF (same as ^D basically).
-
Re: causing bash to logout problem
Hello Jim,
> > kill(getppid(), SIGKILL);
>
> lol No, not got that line. Anyway, that would only kill the application
> and not bash.
Sure it will, as long as the bash is the parent process of the
application.
Cheers,
Loic.
-
Re: causing bash to logout problem
Hi,
Thank you both for your comments, they've been very helpful. I've tried
scanning strings that i'm printing for non-printables but havn't found
any so the search continues, but cheers for the help!