mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 08:41:13 +08:00
Rename $pid (née %self) to $fish_pid
This commit is contained in:
parent
0f59e42802
commit
6d80ab8d74
|
@ -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
|
||||
|
|
2
po/de.po
2
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
|
||||
|
|
2
po/en.po
2
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
|
||||
|
|
4
po/fr.po
4
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'."
|
||||
|
|
2
po/nb.po
2
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
|
||||
|
|
2
po/nn.po
2
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
|
||||
|
|
4
po/pl.po
4
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'."
|
||||
|
|
|
@ -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
|
||||
|
|
2
po/sv.po
2
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}};
|
||||
|
||||
|
|
|
@ -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<long>(getpid()));
|
||||
// Set the $fish_pid variable (%self replacement)
|
||||
env_set_one(L"fish_pid", ENV_GLOBAL, to_string<long>(getpid()));
|
||||
|
||||
// Set the $hostname variable
|
||||
wcstring hostname = L"fish";
|
||||
|
|
|
@ -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'.")
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue
Block a user