From 51632b8e027c44868e10ea0f3d8270de87eacd9f Mon Sep 17 00:00:00 2001 From: Mark Birbeck Date: Fri, 13 Feb 2015 22:58:02 +0000 Subject: [PATCH 1/5] fix(#43): allow shell to be overridden --- OsShell.py | 13 +++++++++++++ ShellCommand.sublime-settings | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/OsShell.py b/OsShell.py index b58251d..4fd9c04 100644 --- a/OsShell.py +++ b/OsShell.py @@ -72,9 +72,22 @@ def _process(commands, callback=None, stdin=None, settings=None, working_dir=Non if bash_env is not None: command = '. {} && {}'.format(bash_env, command) + # Work out whether the executable is being overridden in the + # configuration settings or an environment variable: + # + # NOTE: We don't need to check COMSPEC on Windows since this + # is already done inside Popen(). + # + executable = None + if settings is not None and settings.has('shell-file-name'): + executable = settings.get('shell-file-name') + else: + executable = os.getenv('SHELL') + try: proc = subprocess.Popen(command, + executable=executable, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, diff --git a/ShellCommand.sublime-settings b/ShellCommand.sublime-settings index 242be21..b6dca90 100644 --- a/ShellCommand.sublime-settings +++ b/ShellCommand.sublime-settings @@ -11,6 +11,16 @@ , "comint-scroll-show-maximum-output": false + /** + * shell-file-name provides the name of the shell to use when + * executing commands. If this value is not set then the SHELL + * environment variable is used on Posix systems, or COMSPEC on + * Windows. If none of these is set then the behaviour is defined + * by subprocess.Popen(): + */ + +//, "shell-file-name": "bash" + /** * The default behaviour in Emacs when there is no output from a successful * shell command, is to show a message in the buffer. We'll make that From 180dde535f882722bdae730dc09c913cc204a137 Mon Sep 17 00:00:00 2001 From: Mark Birbeck Date: Fri, 13 Feb 2015 22:59:53 +0000 Subject: [PATCH 2/5] update changelog --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 5d547d5..025bb5a 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,10 @@ By default long-running commands will update the buffer as and when data is avai # Changelog +2015-02-13 (v0.14.0) + +Added option to allow the shell used to be overridden. Closes issue #32. + 2015-02-13 (v0.13.1) Added option to allow the end of a view to always be visible. Closes issue #39. From e00294d99cc80f93547d65979194e7d5b674c22b Mon Sep 17 00:00:00 2001 From: Mark Birbeck Date: Fri, 13 Feb 2015 23:02:41 +0000 Subject: [PATCH 3/5] docs(README): add documentation for 'shell-file-name' --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 025bb5a..69cc096 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ NOTE: Some variable names have hyphens and some underscores. This is because I'm If comint-scroll-show-maximum-output is `True`, then scrolling due to arrival of output tries to place the last line of text at the bottom line of the window, so as to show as much useful text as possible. (This mimics the scrolling behavior of many terminals.) The default is `False`. +## shell-file-name + +`shell-file-name` provides the name of the shell to use when executing commands. If this value is not set then either the `SHELL` or `COMSPEC` environment variable is used, depending on whether Sublime Text is running on a Posix or Windows system. If none of these is set then the behaviour is defined by `subprocess.Popen()`. + ## show_success_but_no_output_message Indicates whether to show a message when the shell command returns no output, or the output is just whitespace. The default value is `False`, i.e., no window is created if the command doesn't return anything. From 1b099e61aadb6588d806df4815a5c8ff2a140a76 Mon Sep 17 00:00:00 2001 From: Mark Birbeck Date: Fri, 13 Feb 2015 23:04:39 +0000 Subject: [PATCH 4/5] add installation message --- message.json | 3 ++- messages/0.14.0.txt | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 messages/0.14.0.txt diff --git a/message.json b/message.json index 07c05a7..87c2c92 100644 --- a/message.json +++ b/message.json @@ -4,5 +4,6 @@ "0.12.1": "messages/0.12.1.txt", "0.12.2": "messages/0.12.2.txt", "0.13.0": "messages/0.13.0.txt", - "0.13.1": "messages/0.13.1.txt" + "0.13.1": "messages/0.13.1.txt", + "0.14.0": "messages/0.14.0.txt" } \ No newline at end of file diff --git a/messages/0.14.0.txt b/messages/0.14.0.txt new file mode 100644 index 0000000..41abe85 --- /dev/null +++ b/messages/0.14.0.txt @@ -0,0 +1,3 @@ +Version 0.14.0 Release Notes + +Added shell-file-name which provides the name of the shell to use when executing commands. If this value is not set then either the SHELL or COMSPEC environment variable is used, depending on whether Sublime Text is running on a Posix or Windows system. If none of these is set then the behaviour is defined by subprocess.Popen(). From d39ffd2b19c956b7bf83de3477484b23298fe6c5 Mon Sep 17 00:00:00 2001 From: Mark Birbeck Date: Fri, 13 Feb 2015 23:05:08 +0000 Subject: [PATCH 5/5] bump version number --- ShellCommand.sublime-settings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellCommand.sublime-settings b/ShellCommand.sublime-settings index b6dca90..c6442f9 100644 --- a/ShellCommand.sublime-settings +++ b/ShellCommand.sublime-settings @@ -1,5 +1,5 @@ { - "version": "0.13.1" + "version": "0.14.0" /** * From Emacs: If comint-scroll-show-maximum-output is true, then