From 6d80ab8d749553a8a61bcd97df3e8b964fa6c1e0 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 15 Mar 2018 18:31:15 -0500 Subject: [PATCH] =?UTF-8?q?Rename=20$pid=20(n=C3=A9e=20%self)=20to=20$fish?= =?UTF-8?q?=5Fpid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- po/de.po | 2 +- po/en.po | 2 +- po/fr.po | 4 ++-- po/nb.po | 2 +- po/nn.po | 2 +- po/pl.po | 4 ++-- po/pt_BR.po | 2 +- po/sv.po | 2 +- po/zh_CN.po | 2 +- share/functions/__fish_complete_pids.fish | 4 ++-- share/functions/edit_command_buffer.fish | 4 ++-- share/functions/suspend.fish | 6 +++--- src/builtin_jobs.cpp | 2 +- src/env.cpp | 6 +++--- src/parse_constants.h | 2 +- tests/exit.expect | 2 +- tests/signals.expect | 4 ++-- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67fe9ec34..d2ac6f694 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ This section is for changes merged to the `major` branch that are not also merge - `for` loop control variables are no longer local to the `for` block (#1935). - A literal `{}` now expands to itself, rather than nothing. This makes working with `find -exec` easier. (#1109, #4632) - Successive commas in brace expansions are handled in less surprising manner (`{,,,}` expands to four empty strings rather than an empty string, a comma and an empty string again). (#3002, #4632). -- `%` is no longer used for process and job expansion. `$pid` and `$last_pid` have taken the place of `%self` and `%last` respectively. (#4230, #1202) +- `%` is no longer used for process and job expansion. `$fish_pid` and `$last_pid` have taken the place of `%self` and `%last` respectively. (#4230, #1202) - The new `math` builtin (see below) does not support logical expressions; `test` should be used instead (#4777). ## Notable fixes and improvements diff --git a/po/de.po b/po/de.po index 9825adc4c..7e83305d4 100644 --- a/po/de.po +++ b/po/de.po @@ -2118,7 +2118,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/en.po b/po/en.po index e42c37dee..51d4f7f1c 100644 --- a/po/en.po +++ b/po/en.po @@ -2068,7 +2068,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/fr.po b/po/fr.po index 3d6c85033..c3c90cc9a 100644 --- a/po/fr.po +++ b/po/fr.po @@ -2229,8 +2229,8 @@ msgstr "$? n’est pas le code de retour. Dans fish, veuillez utiliser $status." #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." -msgstr "$$ n’est pas le PID. Dans fish, veuillez utiliser $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." +msgstr "$$ n’est pas le PID. Dans fish, veuillez utiliser $fish_pid." #: src/parse_constants.h:278 msgid "$# is not supported. In fish, please use 'count $argv'." diff --git a/po/nb.po b/po/nb.po index 9112bcaba..52e244788 100644 --- a/po/nb.po +++ b/po/nb.po @@ -2027,7 +2027,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/nn.po b/po/nn.po index 27cb7902d..1241996d8 100644 --- a/po/nn.po +++ b/po/nn.po @@ -2027,7 +2027,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/pl.po b/po/pl.po index 9bb69f753..37c89891d 100644 --- a/po/pl.po +++ b/po/pl.po @@ -2051,9 +2051,9 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" -"$$ nie jest numerem identyfikacyjnym procesu. W fish używane jest $pid." +"$$ nie jest numerem identyfikacyjnym procesu. W fish używane jest $fish_pid." #: src/parse_constants.h:278 msgid "$# is not supported. In fish, please use 'count $argv'." diff --git a/po/pt_BR.po b/po/pt_BR.po index 6973708be..4e3ce749c 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -2084,7 +2084,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/sv.po b/po/sv.po index fa4458e04..ff9d90655 100644 --- a/po/sv.po +++ b/po/sv.po @@ -2031,7 +2031,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/po/zh_CN.po b/po/zh_CN.po index 9e8b37ce1..8a09b58ee 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -2045,7 +2045,7 @@ msgstr "" #: src/parse_constants.h:275 #, c-format -msgid "$$ is not the pid. In fish, please use $pid." +msgid "$$ is not the pid. In fish, please use $fish_pid." msgstr "" #: src/parse_constants.h:278 diff --git a/share/functions/__fish_complete_pids.fish b/share/functions/__fish_complete_pids.fish index e352bb3fb..9036b0559 100644 --- a/share/functions/__fish_complete_pids.fish +++ b/share/functions/__fish_complete_pids.fish @@ -1,10 +1,10 @@ function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions" # This may be a bit slower, but it's nice - having the tty displayed is really handy # 'tail -n +2' deletes the first line, which contains the headers - # $pid is removed from output by string match -r -v + # $fish_pid is removed from output by string match -r -v # Display the tty if available # But not if it's just question marks, meaning no tty - ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' '' + ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$fish_pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' '' end diff --git a/share/functions/edit_command_buffer.fish b/share/functions/edit_command_buffer.fish index 94fce6413..91ab89278 100644 --- a/share/functions/edit_command_buffer.fish +++ b/share/functions/edit_command_buffer.fish @@ -6,9 +6,9 @@ function edit_command_buffer --description 'Edit the command buffer in an extern else # We should never execute this block but better to be paranoid. if set -q TMPDIR - set f $TMPDIR/fish.$pid.fish + set f $TMPDIR/fish.$fish_pid.fish else - set f /tmp/fish.$pid.fish + set f /tmp/fish.$fish_pid.fish end touch $f or return 1 diff --git a/share/functions/suspend.fish b/share/functions/suspend.fish index a8803f670..0babd35c4 100644 --- a/share/functions/suspend.fish +++ b/share/functions/suspend.fish @@ -18,11 +18,11 @@ function suspend --description 'Suspend the current shell.' end if status is-interactive - echo -ns 'Suspending ' $pid ': run' - echo -n (set_color --bold) 'kill -CONT' $pid (set_color normal) + echo -ns 'Suspending ' $fish_pid ': run' + echo -n (set_color --bold) 'kill -CONT' $fish_pid (set_color normal) echo 'from another terminal to resume' end # XXX always causes a zombie until one fg's when we do this: - kill -STOP $pid + kill -STOP $fish_pid end diff --git a/src/builtin_jobs.cpp b/src/builtin_jobs.cpp index 019682c4e..d82bdb1a3 100644 --- a/src/builtin_jobs.cpp +++ b/src/builtin_jobs.cpp @@ -125,7 +125,7 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) { {L"group", no_argument, NULL, 'g'}, {L"help", no_argument, NULL, 'h'}, {L"last", no_argument, NULL, 'l'}, - {L"pid", no_argument, NULL, 'p'}, + {L"fish_pid", no_argument, NULL, 'p'}, {L"quiet", no_argument, NULL, 'q'}, {nullptr, 0, NULL, 0}}; diff --git a/src/env.cpp b/src/env.cpp index 67cf0fbe7..2783b2eb0 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -322,7 +322,7 @@ bool string_set_contains(const T &set, const wchar_t *val) { /// Check if a variable may not be set using the set command. static bool is_read_only(const wchar_t *val) { - const string_set_t env_read_only = {L"PWD", L"SHLVL", L"history", L"status", L"version", L"pid", L"hostname", L"current_cmd"}; + const string_set_t env_read_only = {L"PWD", L"SHLVL", L"history", L"status", L"version", L"fish_pid", L"hostname", L"current_cmd"}; return string_set_contains(env_read_only, val); } @@ -956,8 +956,8 @@ void env_init(const struct config_paths_t *paths /* or NULL */) { wcstring version = str2wcstring(get_fish_version()); env_set_one(L"version", ENV_GLOBAL, version); - // Set the $pid variable (%self replacement) - env_set_one(L"pid", ENV_GLOBAL, to_string(getpid())); + // Set the $fish_pid variable (%self replacement) + env_set_one(L"fish_pid", ENV_GLOBAL, to_string(getpid())); // Set the $hostname variable wcstring hostname = L"fish"; diff --git a/src/parse_constants.h b/src/parse_constants.h index b84de73e6..c83b548c6 100644 --- a/src/parse_constants.h +++ b/src/parse_constants.h @@ -260,7 +260,7 @@ void parse_error_offset_source_start(parse_error_list_t *errors, size_t amt); #define ERROR_NOT_STATUS _(L"$? is not the exit status. In fish, please use $status.") /// Error issued on $$. -#define ERROR_NOT_PID _(L"$$ is not the pid. In fish, please use $pid.") +#define ERROR_NOT_PID _(L"$$ is not the pid. In fish, please use $fish_pid.") /// Error issued on $#. #define ERROR_NOT_ARGV_COUNT _(L"$# is not supported. In fish, please use 'count $argv'.") diff --git a/tests/exit.expect b/tests/exit.expect index f6490d2ce..86d7f6510 100644 --- a/tests/exit.expect +++ b/tests/exit.expect @@ -38,7 +38,7 @@ send "exit\r" catch {expect default exp_continue} output wait -# Verify all child processes have been killed. We don't use `-p $pid` because +# Verify all child processes have been killed. We don't use `-p $fish_pid` because # if the shell has a bug the child processes might have been reparented to pid # 1 rather than killed. set status [catch {exec pgrep -l -f "sleep 11"} output] diff --git a/tests/signals.expect b/tests/signals.expect index dc7991b8b..a17ac8902 100644 --- a/tests/signals.expect +++ b/tests/signals.expect @@ -12,13 +12,13 @@ expect_prompt send "sleep 131 &\r" expect_prompt send "sleep 132\r" -exec -- kill -HUP $pid +exec -- kill -HUP $fish_pid # Verify the spawned fish shell has exited. catch {expect default exp_continue} output wait -# Verify all child processes have been killed. We don't use `-p $pid` because +# Verify all child processes have been killed. We don't use `-p $fish_pid` because # if the shell has a bug the child processes might have been reparented to pid # 1 rather than killed. set status [catch {exec pgrep -l -f "sleep 13"} output]