exec: evaluate option exec.command.shell, change default value to "${env:SHELL}" (closes #1356)

v2.8-utf8proc
Sébastien Helleu 2019-06-12 18:29:07 +02:00
parent eb216de9b8
commit 04fd587fff
22 changed files with 104 additions and 63 deletions

View File

@ -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)

View File

@ -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}"+`

View File

@ -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}"+`

View File

@ -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}"+`

View File

@ -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}"+`

View File

@ -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}"+`

View File

@ -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}"+`

View File

@ -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

View File

@ -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 "

View File

@ -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

View File

@ -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 ""

View File

@ -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

View File

@ -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

View File

@ -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\")"

View File

@ -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 "

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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;
}
/*

View File

@ -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);