Commit graph

12755 commits

Author SHA1 Message Date
ridiculousfish
68092c5d21 Bravely have read_blocked return after first read
In commit fd6d814ea4, read_blocked was changed to read until EOF
or the full amount requested is returned. Switch this to returning
as soon as any data is available, which was the behavior prior to
fd6d814ea4.

This will allow builtin_string to output data in a "streaming"
fashion instead of needing to read a large block up-front.
2020-07-30 22:08:54 -07:00
ridiculousfish
81d5a3ea64 Do not add silent mode history items to history
Prior to this fix, if you invoked fish with --private and then used
`read --silent` to read something sensitive, the variable would be
stored in history, with the plain text available through up-arrow.
Fix it to not store items in silent mode.

Note the item was never written to disk; it was only stored in memory.

Fixes #7230
2020-07-30 20:26:01 -07:00
David Adam
caf64fd0ce CHANGELOG: preliminary work on 3.2.0
[ci skip]
2020-07-30 23:02:41 +08:00
ridiculousfish
f7f35d2373 Fix a warning in fish_tests 2020-07-29 20:12:19 -07:00
ridiculousfish
2809d637db Introduce wwrite_to_fd
wwrite_to_fd() is a function which writes a wide string to a file
descriptor without performing any heap allocations.
2020-07-29 19:38:45 -07:00
ridiculousfish
a0cb23bea5 Introduce wcs2string_callback
This is like wcs2string, but instead of returning a std::string, it invokes
a user-supplied function with each converted character.

The idea is to allow interleaved conversion and output.
2020-07-29 19:36:20 -07:00
ridiculousfish
c9b42c6f1f Stop #include-ing wcstringutil.h in flog.h
This is a header dependency that we can break.
2020-07-29 17:04:18 -07:00
ridiculousfish
db086fc5d4 Eliminate wcs2str
Use std::string variants everywhere instead
2020-07-29 16:37:39 -07:00
ridiculousfish
e4b1fc9f6a Remove stdout_read_limit param from exec_process_in_job
This can always be trivially fetched from the parser - no need to pass it
in separately.
2020-07-29 16:04:29 -07:00
Gokul Soumya
b259fe17f9 vi-keybingings: Add missing abbr triggers for command terminators
Abbr expansion on command terminators were added
back in ec74c739 in response to #6970, but vi mode
was not updated.
2020-07-30 01:04:03 +02:00
ridiculousfish
3506274ccf Make in_foreground an explicit param to continue_job
This moves us slightly closer towards fish code in the background. The idea is
that a background job may still have "foreground" sub-jobs, example:

    begin ; sleep 5 ; end &

The begin/end job runs in the background but should wait for `sleep`.

Prior to this fix, fish would see the overall job group is in the background
and not wait for any of its processes. With this change we detach waiting from
is_foreground.
2020-07-27 15:56:24 -07:00
ridiculousfish
3382bc70d2 Fix a stale comment
[ci skip]
2020-07-27 15:36:43 -07:00
ridiculousfish
c35fe879c7 Bravely remove reclaim... param from continue_job, and rework tcsetpgrp calls
This changes how fish attempts to protect itself from calling tcsetpgrp() too
aggressively. Recall that tcsetpgrp() will "force" itself, if SIGTTOU is
ignored (which it is in fish when job control is enabled).

Prior to this fix, we avoided SIGTTINs by only transferring the tty ownership
if fish was already the owner. This dated from a time before we had really
nailed down how pgroups should be assigned. Now we more deliberately assign a
job's pgroup so we don't need this conservative check.

However we still need logic to avoid transferring the tty if fish is not the
owner. The bad case is when job control is enabled while fish is running in the
background - here fish would transfer the tty and "steal" from the foreground
process.

So retain the checks of the current tty owner but migrate them to the point of
calling tcsetpgrp() itself.
2020-07-27 14:51:37 -07:00
ridiculousfish
1823f5d95f Remove the send_sigcont from continue_job
We can just send sigcont if the job is stopped; no need to make this an
explicit param.
2020-07-27 10:48:32 -07:00
Fabian Homborg
84b25855b0 alias: Escape the first word again
See https://stackoverflow.com/questions/63115744/alias-with-spaces-and-arguments-in-fish-3

This was broken in 115892ccd2
2020-07-27 17:19:44 +02:00
David Adam
7b5160e676 fish.spec: build depends on procps to support new jobs tests 2020-07-27 22:21:37 +08:00
ridiculousfish
6d77a93cc2 Improve commenting in exec_job
[ci skip]
2020-07-26 10:45:02 -07:00
Fabian Homborg
6356912702 docs: Expand background section
It's not entirely clear why there's two sections right now, tbh.

[ci skip]
2020-07-26 17:33:11 +02:00
Fabian Homborg
50a40175f1 docs: More on conditionals directly
It's weird to force people to go to the separate pages, at least give
some simple examples here and link to the tutorial.

[ci skip]
2020-07-26 17:33:11 +02:00
Fabian Homborg
cbd3adaa63 docs: Mention psub in the command substitution chapter
[ci skip]
2020-07-26 17:33:10 +02:00
Mahmoud Al-Qudsi
f64711a363
Merge pull request #7189 from zanchey/disown-pids
Disown PIDs as well as PGIDs

Closes #7183
2020-07-25 21:02:37 -05:00
Mahmoud Al-Qudsi
d46b9ff9be Remove repeated acquire of disowned pid lock in a loop 2020-07-25 20:45:08 -05:00
David Adam
2c5d4937e3 disown: add tests for disowned jobs in scripts 2020-07-25 20:38:59 -05:00
David Adam
2720f3d2ef proc: disown PIDs, not just PGIDs
add_disowned_pgid skipped jobs that have a PGID equal to the running
process. However, this includes processes started in config.fish or when
job control is turned off, so they never get waited on.

Instead, refactor this function to add_disowned_job, and add either the PGID or
all the PIDs of the job to the list of disowned PIDs/PGIDs.

Fixes #7183.
2020-07-25 20:38:59 -05:00
David Adam
025a0d3cf5 proc: add log message for reaped disowned IDs 2020-07-25 20:35:54 -05:00
Ryan Burns
ca4f2369d1 Fix build when ncurses is in nonstandard prefix 2020-07-25 11:21:36 -07:00
Johannes Altmanninger
233945b58b completions/git.fish: fix completions for "git config"
gui.fontui can be like "-family ..."
2020-07-25 18:53:24 +02:00
ridiculousfish
bae64f8a8a Modest cleanup of profiling
This is a set of miscellaneous cleanup for profiling.

An errant newline has been removed from 'if' statement output, which got
introduced with the new ast.
Switch from storing unique_ptr to a deque, which allocates less.
Collapse "parse" and "exec" times into just a single value "duration". The
"parse" time no longer makes sense, as we now parse ahead of time.
2020-07-24 11:53:07 -07:00
Shun Sakai
25e9a758ad Add completions for p7zip 2020-07-24 17:42:44 +02:00
Stefan Tatschner
d4fafc15ca completions: Remove -f from pacman -U
pacman -U is intended to be used with (among others) files like this:

        # pacman -U ./linux-headers-5.6.2.arch1-2-x86_64.pkg.tar.zst

Thus, let's enable file path completion for this kind of operation.
2020-07-24 19:49:20 +08:00
Fabian Homborg
65f932edd2 docs: Also mention functions and type
One of the nicest things about fish is how introspectable it is. We
should probably get people to just mess around and see what is
implemented how. This is a step in that direction.

[ci skip]
2020-07-23 22:27:32 +02:00
Fabian Homborg
b485daa987 docs: Rewrite "Functions" section
More examples, links to funced/funcsave, autoloading, wrappers

[ci skip]
2020-07-23 17:49:43 +02:00
Fabian Homborg
a30630a1df Add some rudimentary fg tests
See #5451
2020-07-21 20:31:32 +02:00
Fabian Homborg
825f821623 Pexpects: Increase a timeout
This failed on sr.ht's FreeBSD machines once.
2020-07-21 20:27:55 +02:00
Fabian Homborg
5b706faa73 open: Workaround an xdg-open bug
If it can't recognize the DE, xdg-open uses a "generic" way of opening
things where it doesn't spawn off a DE-provided utility like kde-open.

This sounds great, but it fails to fork and therefore blocks the
terminal.

So we start it in the background and disown it.

Fixes #7215.
2020-07-21 16:59:05 +02:00
ridiculousfish
7d2d2c97b2 Fix a compiler warning in builtin_printf 2020-07-19 16:51:11 -07:00
ridiculousfish
54b642bc6f Factor job groups into their own file
Migrate out of proc.h, which has become too long.
2020-07-19 16:42:29 -07:00
ridiculousfish
4840d115b6 Sort the source files in CMakeLists 2020-07-19 16:07:01 -07:00
ridiculousfish
56e250d467 Remove a commented-out field 2020-07-19 15:48:16 -07:00
Johannes Altmanninger
b3485d2457 Have the pager use the correct prefix for case-corrected completions
Follow-up to 28d67c8f which only fixed inserting such completions.
2020-07-20 00:38:01 +02:00
Johannes Altmanninger
a61e97a8b9 Fix case-correcting completion stomping token on common prefix
The prefix has already been case-corrected at this point and the remaining
completions are for the suffix only.

Fixes #7211

Introduced in
28d67c8f Show completion list on Tab also if a common prefix was inserted
2020-07-19 23:40:07 +02:00
ridiculousfish
dff4f140b0 Make the list of blocked events const
These are events that have been queued but not yet fired. There's no
reason to modify the events after creating them. Mark them as const
to ensure that doesn't happen.
2020-07-19 12:03:10 -07:00
Fabian Homborg
31e19db64a Update littlecheck
Update littlecheck to dda885bed9d4a4c6ea1d9d66d0ca93fb54492b7c,
which also displays the context view when the error is on the first line.
2020-07-18 22:10:11 +02:00
ridiculousfish
7f8c00c20a Remove job_t::wants_terminal
This now lives in the job group, not individual jobs.
2020-07-18 12:42:44 -07:00
ridiculousfish
ba8b89873e Teach a job its command at constructor time
No point in allowing this to be set later.
2020-07-18 12:42:44 -07:00
ridiculousfish
f30ce21aaa terminal_maybe_give_to_job to operate on groups, not jobs
Assigning the tty is really a function of a job group, not an individual
job. Reflect that in terminal_maybe_give_to_job_group and also
terminal_return_from_job_group.
2020-07-18 12:42:44 -07:00
ridiculousfish
40c9bda7fd Store the command that produced a job group in the group
This will enable us to replace more uses of jobs with job groups.
2020-07-18 12:42:44 -07:00
Charles Gould
f1302d336a docs: fix a few links
- add missing links for some commands (control flow section)
- fix broken links that use the old syntax (#tut_ links)
- miscellaneous fixing of backticks/emphasis
2020-07-18 20:46:50 +02:00
ridiculousfish
3571754e06 Only perform universal barriers for the principal env stack
In practice this means that, if fish ever gets multiple variable stacks,
we will only incorporate environment variable changes from other fish
instances on the "main thread."
2020-07-16 16:16:03 -07:00
Daniel Kravetz
0f78700f6b Update share/completions/k3d.fish
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2020-07-16 15:11:40 -07:00