Re: .ONESHELL enhancement?
David Boyce <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Sep 22, 2009 at 1:53 PM, Eli Zaretskii <[email protected]> wrote: > "&&" works on Windows only with cmd.exe (and probably also 4nt and > friends), but not for command.com. The latter cannot support multiple > commands on a single command line, so we will need to punt. > > And for the DOS (a.k.a. DJGPP) port, you will need to use ";" instead, > since the `system' function in DJGPP enhances the system shell with > several features, including this one. Thanks, worth noting. It would probably be best to document .ONESHELL as a *request* to group commands together "wherever practical", leaving wiggle room for funky cases like these. It's also worth noting that there exists a corner case where it would NOT save processes. E.g.: foo: touch bar mv bar foo normally requires two fork/execs due to the "fast path", whereas when throwing in && it would technically require three. I don't think this is a real concern because - It's a corner case with trivial consequences which would typically be swamped by the positive effects. - It's a corner case you only get when you ask for it. - Most modern shells are smart enough on their own to skip forking before the "mv", so we're back to the original two processes. - It's still aesthetically superior because "/bin/sh -c "touch bar && mv bar foo" self-documents that bar is a temporary file and that the construction of foo is logically atomic, whereas the original does not. DSB