summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc4
-rw-r--r--doc/de/autogen/user/exec_options.adoc4
-rw-r--r--doc/en/autogen/user/exec_options.adoc4
-rw-r--r--doc/fr/autogen/user/exec_options.adoc4
-rw-r--r--doc/it/autogen/user/exec_options.adoc4
-rw-r--r--doc/ja/autogen/user/exec_options.adoc4
-rw-r--r--doc/pl/autogen/user/exec_options.adoc4
-rw-r--r--po/cs.po5
-rw-r--r--po/de.po6
-rw-r--r--po/es.po5
-rw-r--r--po/fr.po10
-rw-r--r--po/hu.po5
-rw-r--r--po/it.po5
-rw-r--r--po/ja.po6
-rw-r--r--po/pl.po6
-rw-r--r--po/pt.po5
-rw-r--r--po/pt_BR.po5
-rw-r--r--po/ru.po5
-rw-r--r--po/tr.po5
-rw-r--r--po/weechat.pot5
-rw-r--r--src/plugins/exec/exec-command.c61
-rw-r--r--src/plugins/exec/exec-config.c5
22 files changed, 104 insertions, 63 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 0684383ea..832fb2bd8 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -18,6 +18,10 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
[[v2.6]]
== Version 2.6 (under dev)
+New features::
+
+ * exec: evaluate option exec.command.shell, change default value to "${env:SHELL}" (issue #1356)
+
Bug fixes::
* core: replace char "," by "~" in color codes to separate foreground from background (issue #1264)
diff --git a/doc/de/autogen/user/exec_options.adoc b/doc/de/autogen/user/exec_options.adoc
index efd94923e..b41fe8888 100644
--- a/doc/de/autogen/user/exec_options.adoc
+++ b/doc/de/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** Standardwert: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** Beschreibung: pass:none[shell welche für den Befehl "/exec -sh" genutzt werden soll; hierbei kann es sich um den Namen der shell handeln der über PATH gefunden wird (zum Beispiel "bash") oder man nutzt eine absolute Pfadangabe zur Binärdatei (zum Beispiel "/bin/bash")]
+** Beschreibung: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash"); if value is empty, "sh" is used (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
-** Standardwert: `+"sh"+`
+** Standardwert: `+"${env:SHELL}"+`
diff --git a/doc/en/autogen/user/exec_options.adoc b/doc/en/autogen/user/exec_options.adoc
index 4ca387283..ad43c5423 100644
--- a/doc/en/autogen/user/exec_options.adoc
+++ b/doc/en/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** default value: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** description: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
+** description: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash"); if value is empty, "sh" is used (note: content is evaluated, see /help eval)]
** type: string
** values: any string
-** default value: `+"sh"+`
+** default value: `+"${env:SHELL}"+`
diff --git a/doc/fr/autogen/user/exec_options.adoc b/doc/fr/autogen/user/exec_options.adoc
index 185c7b073..f3f1824fb 100644
--- a/doc/fr/autogen/user/exec_options.adoc
+++ b/doc/fr/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** valeur par défaut: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** description: pass:none[shell à utiliser avec la commande "/exec -sh" ; cela peut être seulement le nom du shell s'il est dans le PATH (par exemple "bash") ou le chemin absolu vers le shell (par exemple "/bin/bash")]
+** description: pass:none[shell à utiliser avec la commande "/exec -sh" ; cela peut être seulement le nom du shell s'il est dans le PATH (par exemple "bash") ou le chemin absolu vers le shell (par exemple "/bin/bash"); si la valeur est vide, "sh" est utilisé (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
-** valeur par défaut: `+"sh"+`
+** valeur par défaut: `+"${env:SHELL}"+`
diff --git a/doc/it/autogen/user/exec_options.adoc b/doc/it/autogen/user/exec_options.adoc
index e65192aae..edfeec66b 100644
--- a/doc/it/autogen/user/exec_options.adoc
+++ b/doc/it/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** valore predefinito: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** descrizione: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash")]
+** descrizione: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash"); if value is empty, "sh" is used (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
-** valore predefinito: `+"sh"+`
+** valore predefinito: `+"${env:SHELL}"+`
diff --git a/doc/ja/autogen/user/exec_options.adoc b/doc/ja/autogen/user/exec_options.adoc
index 8d923c5ba..562b04476 100644
--- a/doc/ja/autogen/user/exec_options.adoc
+++ b/doc/ja/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** デフォルト値: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** 説明: pass:none[コマンド "/exec -sh" で使うシェル; シェルの名前 (PATH に含まれるシェル、例えば "bash" など) もしくはシェルへの絶対パス (例えば "/bin/bash")]
+** 説明: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash"); if value is empty, "sh" is used (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
-** デフォルト値: `+"sh"+`
+** デフォルト値: `+"${env:SHELL}"+`
diff --git a/doc/pl/autogen/user/exec_options.adoc b/doc/pl/autogen/user/exec_options.adoc
index a4f51a46e..a102a7663 100644
--- a/doc/pl/autogen/user/exec_options.adoc
+++ b/doc/pl/autogen/user/exec_options.adoc
@@ -27,7 +27,7 @@
** domyślna wartość: `+0+`
* [[option_exec.command.shell]] *exec.command.shell*
-** opis: pass:none[powłoka używana przez komendę "/exec -sh"; może to być nazwa powłoki jeśli znajduje się ona w PATH (na przykład "bash") lub ścieżka absolutna (na przykład "/bin/bash")]
+** opis: pass:none[shell to use with command "/exec -sh"; it can be just the name of shell if it is in PATH (for example "bash") or the absolute path to the shell (for example "/bin/bash"); if value is empty, "sh" is used (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
-** domyślna wartość: `+"sh"+`
+** domyślna wartość: `+"${env:SHELL}"+`
diff --git a/po/cs.po b/po/cs.po
index 14e2fb62c..99e170b28 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5319,7 +5319,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/de.po b/po/de.po
index 9f6809ecd..25c59d5f7 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-06-04 20:21+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -6496,10 +6496,12 @@ msgstr ""
"Wartezeit bis nicht mehr ausgeführte Befehle gelöscht werden (in Sekunden, 0 "
"= lösche Befehle unmittelbar, -1 = niemals löschen)"
+#, fuzzy
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
"shell welche für den Befehl \"/exec -sh\" genutzt werden soll; hierbei kann "
"es sich um den Namen der shell handeln der über PATH gefunden wird (zum "
diff --git a/po/es.po b/po/es.po
index b71152d4f..1a061efab 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5524,7 +5524,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/fr.po b/po/fr.po
index a815cc8ee..e53eb9a0b 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
-"PO-Revision-Date: 2019-06-04 22:26+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
+"PO-Revision-Date: 2019-06-12 18:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -6346,11 +6346,13 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
"shell à utiliser avec la commande \"/exec -sh\" ; cela peut être seulement "
"le nom du shell s'il est dans le PATH (par exemple \"bash\") ou le chemin "
-"absolu vers le shell (par exemple \"/bin/bash\")"
+"absolu vers le shell (par exemple \"/bin/bash\"); si la valeur est vide, \"sh"
+"\" est utilisé (note : le contenu est évalué, voir /help eval)"
msgid "text color for a running command flag in list of commands"
msgstr ""
diff --git a/po/hu.po b/po/hu.po
index f6366e9e1..64a914d95 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4860,7 +4860,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/it.po b/po/it.po
index 99c2370bb..448900302 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:31+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5686,7 +5686,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/ja.po b/po/ja.po
index df7830869..71a07e45d 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-26 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -6082,10 +6082,12 @@ msgstr ""
"接続を切ったクライアントを追い出すまでの遅延時間 (秒単位、0 = すぐにクライア"
"ントを追い出す、-1 = 追い出さない)"
+#, fuzzy
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
"コマンド \"/exec -sh\" で使うシェル; シェルの名前 (PATH に含まれるシェル、例"
"えば \"bash\" など) もしくはシェルへの絶対パス (例えば \"/bin/bash\")"
diff --git a/po/pl.po b/po/pl.po
index 398307599..bbc1d465a 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-06-01 00:12+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -6197,10 +6197,12 @@ msgstr ""
"opóźnienie dla kasowania zakończonych komend (w sekundach, 0 = natychmiast, "
"-1 = nigdy)"
+#, fuzzy
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
"powłoka używana przez komendę \"/exec -sh\"; może to być nazwa powłoki jeśli "
"znajduje się ona w PATH (na przykład \"bash\") lub ścieżka absolutna (na "
diff --git a/po/pt.po b/po/pt.po
index da4532b87..584258350 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -6043,7 +6043,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
msgid "text color for a running command flag in list of commands"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 020dfdea9..50c9346f9 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5497,7 +5497,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/ru.po b/po/ru.po
index 501eb8091..d326a57af 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4897,7 +4897,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/tr.po b/po/tr.po
index 49ceed599..30e9187bf 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2019-05-13 21:32+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4453,7 +4453,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
#, fuzzy
diff --git a/po/weechat.pot b/po/weechat.pot
index d710e0dc6..07b6f54e7 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2019-06-04 20:20+0200\n"
+"POT-Creation-Date: 2019-06-12 18:25+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4435,7 +4435,8 @@ msgstr ""
msgid ""
"shell to use with command \"/exec -sh\"; it can be just the name of shell if "
"it is in PATH (for example \"bash\") or the absolute path to the shell (for "
-"example \"/bin/bash\")"
+"example \"/bin/bash\"); if value is empty, \"sh\" is used (note: content is "
+"evaluated, see /help eval)"
msgstr ""
msgid "text color for a running command flag in list of commands"
diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c
index 996c00ea7..723baff7b 100644
--- a/src/plugins/exec/exec-command.c
+++ b/src/plugins/exec/exec-command.c
@@ -405,14 +405,17 @@ int
exec_command_run (struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol, int start_arg)
{
- char str_buffer[512], *default_shell = "sh";
- const char *ptr_shell;
+ char str_buffer[512], *shell, *default_shell = "sh";
struct t_exec_cmd *new_exec_cmd;
struct t_exec_cmd_options cmd_options;
struct t_hashtable *process_options;
struct t_infolist *ptr_infolist;
struct t_gui_buffer *ptr_new_buffer;
+ shell = NULL;
+ new_exec_cmd = NULL;
+ process_options = NULL;
+
/* parse command options */
cmd_options.command_index = -1;
cmd_options.use_shell = 0;
@@ -444,29 +447,33 @@ exec_command_run (struct t_gui_buffer *buffer,
_("%s%s: invalid options in option "
"exec.command.default_options"),
weechat_prefix ("error"), EXEC_PLUGIN_NAME);
- return WEECHAT_RC_ERROR;
+ goto error;
}
if (!exec_command_parse_options (&cmd_options, argc, argv, start_arg, 1))
- return WEECHAT_RC_ERROR;
+ goto error;
/* options "-bg" and "-o"/"-oc"/"-n" are incompatible */
if (cmd_options.detached
&& (cmd_options.output_to_buffer || cmd_options.new_buffer))
- return WEECHAT_RC_ERROR;
+ {
+ goto error;
+ }
/* options "-pipe" and "-bg"/"-o"/"-oc"/"-n" are incompatible */
if (cmd_options.pipe_command
&& (cmd_options.detached || cmd_options.output_to_buffer
|| cmd_options.new_buffer))
- return WEECHAT_RC_ERROR;
+ {
+ goto error;
+ }
/* command not found? */
if (cmd_options.command_index < 0)
- return WEECHAT_RC_ERROR;
+ goto error;
new_exec_cmd = exec_add ();
if (!new_exec_cmd)
- return WEECHAT_RC_ERROR;
+ goto error;
/* create hashtable for weechat_hook_process_hashtable() */
process_options = weechat_hashtable_new (32,
@@ -474,10 +481,8 @@ exec_command_run (struct t_gui_buffer *buffer,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (!process_options)
- {
- exec_free (new_exec_cmd);
- return WEECHAT_RC_ERROR;
- }
+ goto error;
+
/* automatically disable shell if we are downloading an URL */
if (strncmp (argv_eol[cmd_options.command_index], "url:", 4) == 0)
cmd_options.use_shell = 0;
@@ -485,13 +490,15 @@ exec_command_run (struct t_gui_buffer *buffer,
/* get default shell */
if (cmd_options.use_shell)
{
- ptr_shell = weechat_config_string (exec_config_command_shell);
- if (!ptr_shell || !ptr_shell[0])
- ptr_shell = default_shell;
- }
- else
- {
- ptr_shell = NULL;
+ shell = weechat_string_eval_expression (
+ weechat_config_string (exec_config_command_shell),
+ NULL, NULL, NULL);
+ if (!shell || !shell[0])
+ {
+ if (shell)
+ free (shell);
+ shell = strdup (default_shell);
+ }
}
if (cmd_options.use_shell)
@@ -590,13 +597,13 @@ exec_command_run (struct t_gui_buffer *buffer,
{
weechat_printf (NULL, "%s: executing command: \"%s%s%s%s\"",
EXEC_PLUGIN_NAME,
- (cmd_options.use_shell) ? ptr_shell : "",
+ (cmd_options.use_shell) ? shell : "",
(cmd_options.use_shell) ? " -c '" : "",
argv_eol[cmd_options.command_index],
(cmd_options.use_shell) ? "'" : "");
}
new_exec_cmd->hook = weechat_hook_process_hashtable (
- (cmd_options.use_shell) ? ptr_shell : argv_eol[cmd_options.command_index],
+ (cmd_options.use_shell) ? shell : argv_eol[cmd_options.command_index],
process_options,
cmd_options.timeout * 1000,
&exec_process_cb,
@@ -626,9 +633,21 @@ exec_command_run (struct t_gui_buffer *buffer,
argv_eol[cmd_options.command_index]);
}
+ if (shell)
+ free (shell);
weechat_hashtable_free (process_options);
return WEECHAT_RC_OK;
+
+error:
+ if (shell)
+ free (shell);
+ if (new_exec_cmd)
+ exec_free (new_exec_cmd);
+ if (process_options)
+ weechat_hashtable_free (process_options);
+
+ return WEECHAT_RC_ERROR;
}
/*
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index fe993dfbe..c8fb0ea97 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -141,8 +141,9 @@ exec_config_init ()
"shell", "string",
N_("shell to use with command \"/exec -sh\"; it can be just the name "
"of shell if it is in PATH (for example \"bash\") or the absolute "
- "path to the shell (for example \"/bin/bash\")"),
- NULL, 0, 0, "sh", NULL, 0,
+ "path to the shell (for example \"/bin/bash\"); if value is empty, "
+ "\"sh\" is used (note: content is evaluated, see /help eval)"),
+ NULL, 0, 0, "${env:SHELL}", NULL, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);