[phobos] [D-Programming-Language/phobos] 963f7e: Issue 15276: Allow users to specify shell for exec...

GitHub via phobos phobos at puremagic.com
Tue Jan 12 03:59:49 PST 2016


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: 963f7e4170fd02aa07c95562f2554807a8fe9178
      https://github.com/D-Programming-Language/phobos/commit/963f7e4170fd02aa07c95562f2554807a8fe9178
  Author: Mark Isaacson <markisaa at carlshen-mbp.local.DHCP.thefacebook.com>
  Date:   2016-01-05 (Tue, 05 Jan 2016)

  Changed paths:
    M std/process.d

  Log Message:
  -----------
  Issue 15276: Allow users to specify shell for executeShell, pipeShell, spawnShell

This diff: This diff makes it possible to specify your preferred shell for the various `*shell` functions in `std.process`. By default it uses the new `nativeShell` function. `nativeShell` to always returns the native system shell (see the "some history" section for why this is the default value). I chose to create `nativeShell` rather than changeing `userShell` because I think it is still valuable to have something like `userShell` around in Phobos.

The one part of this diff I'm not super thrilled by is the use of variadic arguments (easier to see than to explain); if you have a suggestion for something better I'd love to hear it :).

Note: The default shell is a breaking change for Windows, which probably *should have* been broken same as posix in the diffs listed in the history section below, but I suspect was overlooked. Find rationale behind making a breaking change at all here: https://issues.dlang.org/show_bug.cgi?id=15000.

Some history:
https://github.com/D-Programming-Language/phobos/commit/a524a3571b18e440c4dd751fcf4e2d00b834fb22
and
https://github.com/D-Programming-Language/phobos/commit/f537cb50b5f8f9ad6d841db14b2e0a6cb845d008

Tried to move us from a world where we preferred the shell specified in the SHELL environment variable to a world where we always went with the native system shell, /bin/sh for posix. The former of those revisions was reverted in:
https://github.com/D-Programming-Language/phobos/commit/5b2b1fb59450cfc32ecec3252f543a9f6f34c2a4
Because the documentation was not updated to reflect the change.

Presently: we are in a state of schism, whereby `userShell` has behavior that does not align with what is actually used in `executeShell`, `pipeShell`, and `spawnShell`. This is something we *must* resolve.

Personal pain: This bit me when one of my scripts at work stopped working because it dependend on features that don't exist in `sh` (but do in `bash`, `zsh`, etc). It was really frustrating that there was no simple way to work around this and specify my preferred shell; it is, of course, possible to leverage the various `escape*` functions from `std.process` and `spawnProcess` to use whichever shell I prefer, but this seems like something warranting first class support. I was sad to not have something like this after a breaking change.


  Commit: 9284ee864c38eb062a4bcd57b4a44556fe878b94
      https://github.com/D-Programming-Language/phobos/commit/9284ee864c38eb062a4bcd57b4a44556fe878b94
  Author: Andrei Alexandrescu <andrei at erdani.com>
  Date:   2016-01-12 (Tue, 12 Jan 2016)

  Changed paths:
    M std/process.d

  Log Message:
  -----------
  Merge pull request #3900 from markisaa/issue_15276

Issue 15276: Allow users to specify shell for executeShell, pipeShell, spawnShell


Compare: https://github.com/D-Programming-Language/phobos/compare/3641f466f981...9284ee864c38


More information about the phobos mailing list