This is an ancient bug which was fixed in the old Shell but has reappeared with the new one in FE.
To reproduce:
* Open the Shell
* Type "NotePad"
* Close the Shell without pressing return
NotePad opens! Also, the Shell doesn't close...
Shell executes command on close
- colinw
- AmigaOS Core Developer
- Posts: 218
- Joined: Mon Aug 15, 2011 10:20 am
- Location: Brisbane, QLD. Australia.
Re: Shell executes command on close
Of course it won't close, you are running notepad syncronously, this is how it works and always did, (or should have).
The shell process won't be able to end until the command returns from using it.
If you want the shell process to close immediately, you must start the command asyncronously with "run" so it has
its own separate process to work in (and also redirect the three default streams).
run >nil: *>nil: <nil: notepad
The shell process won't be able to end until the command returns from using it.
If you want the shell process to close immediately, you must start the command asyncronously with "run" so it has
its own separate process to work in (and also redirect the three default streams).
run >nil: *>nil: <nil: notepad
Re: Shell executes command on close
I think the point he was trying to make is that the shell assumes that anything on the command line should be executed when the shell is closed. Shouldn't that be taken as a "cancel" event, rather than a positive event?
Simon
Simon
Re: Shell executes command on close
The thing is, he isn't running NotePad at all, as he never executed the commandcolinw wrote:Of course it won't close, you are running notepad syncronously

The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
- colinw
- AmigaOS Core Developer
- Posts: 218
- Joined: Mon Aug 15, 2011 10:20 am
- Location: Brisbane, QLD. Australia.
Re: Shell executes command on close
Ahh, I understand what you mean now, i'm so used to hitting <ENTER> that it has become automatic.Rigo wrote:I think the point he was trying to make is that the shell assumes that anything on the command line should be executed when
the shell is closed. Shouldn't that be taken as a "cancel" event, rather than a positive event?
Simon
What it appears to be doing is just flushing the line buffer when a close event is encountered.
I guess because the shell process is about to be terminated and freed, flushing pending buffers could make sence,
it just doesn't dump the queued characters, but instead acts like it had an <ENTER> key pressed just before.
I think it's mostly semantical, a bit like whether your dog barks or not on the way down, when it jumps off a 20 story building.
It's still dead either way.
Last edited by colinw on Sun Jan 25, 2015 10:57 pm, edited 1 time in total.
- tonyw
- AmigaOS Core Developer
- Posts: 1483
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Shell executes command on close
I am loathe to touch that area of code because it is very touchy and every change has a myriad of side effects.
What do you mean by "old Shell fixed the problem"? Which older Shell had the problem and which not-so-old Shell did not?
What do you mean by "old Shell fixed the problem"? Which older Shell had the problem and which not-so-old Shell did not?
cheers
tony
tony
- nbache
- Beta Tester
- Posts: 1744
- Joined: Mon Dec 20, 2010 7:25 pm
- Location: Copenhagen, Denmark
- Contact:
Re: Shell executes command on close
Well, if the command you had typed were 'delete "" all quiet force', you'd hit yourself quite hard if you tried to avoid running it by using the close gadget. Yes, a dumb thing to do in the first place, but you might have thought you were currently in another directory than SYS: ...colinw wrote:I think it's mostly semantical, a bit like whether your dog barks or not on the way down, when it jumps off a 20 story building.
It's still dead either way.
Best regards,
Niels
- colinw
- AmigaOS Core Developer
- Posts: 218
- Joined: Mon Aug 15, 2011 10:20 am
- Location: Brisbane, QLD. Australia.
Re: Shell executes command on close
I guess just clearing the line buffer in the case switch when a close gadget event occurs, should be relatively benign.tonyw wrote: I am loathe to touch that area of code because it is very touchy and every change has a myriad of side effects.
- tonyw
- AmigaOS Core Developer
- Posts: 1483
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: Shell executes command on close
There are several events feeding into that area of code:
Ctrl-\
Close gadget
ACTION_END
The results vary with what has gone before. It's a minefield.
However, I'll take a look when the rush dies down. BZ #9116.
Ctrl-\
Close gadget
ACTION_END
The results vary with what has gone before. It's a minefield.
However, I'll take a look when the rush dies down. BZ #9116.
cheers
tony
tony
Re: Shell executes command on close
The old Shell in 3.x had the same problem, it was fixed sometime during 4.1 (or maybe 4.0, I forget). Certainly it was present back in 3.1 and not in 4.1u6.tonyw wrote:What do you mean by "old Shell fixed the problem"? Which older Shell had the problem and which not-so-old Shell did not?