ridiculousfish
b51edcfcac
Simplify function_info_t and function_data_t
...
Work towards cleaning up function definition. Migrate inherit_vars into
props and capture their values at the point of definition.
2019-11-12 09:53:10 -08:00
ridiculousfish
b0cf94e3ba
Refactor function_prepare_environment
...
Migrate it into exec.cpp to reduce the complexity of
exec_block_or_func_process.
2019-11-10 14:46:21 -08:00
ridiculousfish
ac2eed2ffa
Make io_chain_t store const io_data_t
...
This will make it easier to reason about with concurrent execution.
2019-11-10 14:00:30 -08:00
ridiculousfish
521d0e84f5
Remove non-const get_io_for_fd
...
These could be made unused.
2019-11-10 13:41:12 -08:00
ridiculousfish
2555ecf757
Remove the forbidden function stack
...
Detect forbidden functions directly from the associated block_t.
Also unify where we do stack overflow detection.
2019-11-10 12:36:46 -08:00
ridiculousfish
a7f1d2c0c7
Add support for fish_trace variable to trace execution
...
This adds support for `fish_trace`, a new variable intended to serve the
same purpose as `set -x` as in bash. Setting this variable to anything
non-empty causes execution to be traced. In the future we may give more
specific meaning to the value of the variable.
The user's prompt is not traced unless you run it explicitly. Events are
also not traced because it is noisy; however autoloading is.
Fixes #3427
2019-11-02 14:40:57 -07:00
ridiculousfish
cc1c973025
Remove job_flags as an enum, just use a struct
...
This removes an over-complicated flag implementation, replacing it with
just a plain struct.
2019-10-15 14:40:58 -07:00
ridiculousfish
82eca4bc86
Run clang-format on all files
...
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
Aaron Gyes
22811ebcf6
Remove unused macros
...
Most just left behind after actual code was moved into different files.
2019-09-18 01:31:03 -07:00
ridiculousfish
73bf60754c
Don't assign jobs to fish's pgrp if there's no external process
...
Fixes #6011
2019-08-03 14:43:55 -07:00
ridiculousfish
a33f0eb636
Clean up some logic around when process exit events are sent
2019-07-28 14:36:57 -07:00
ridiculousfish
1f854ec284
Accept a pwd in resolve_file_redirections_to_fds
...
Conceptually allow multiple of these to run in parallel
2019-07-20 17:25:25 -07:00
ridiculousfish
8181883111
Minor refactoring of logic around when a job wants to claim the terminal
...
Introduce should_claim_terminal() which encapsulates an && exprsesion which
was previously repeated a lot.
2019-07-12 13:31:56 -07:00
ridiculousfish
b1a1b617f1
child_setup_process to accept new termowner directly
...
Soon we will have more complicated logic around whether to call tcsetpgrp.
Prepare to centralize the logic by passing in the new term owner pgrp,
instead of having child_setup_process perform the decision.
2019-07-03 18:06:35 -07:00
ridiculousfish
8282369f45
child_setup_process to stop passing the process
...
child_setup_process only cares about whether we are in a forked child, not
the entire process structure. Narrow the parameter.
2019-07-03 17:48:52 -07:00
ridiculousfish
09e4f8ff42
Refactor how the terminal is transferred to jobs
...
Centralize the logic around when a job acquires the terminal.
2019-06-29 15:58:36 -07:00
ridiculousfish
98ba7d7790
Simplify maybe_assign_terminal()
...
Move this out of postfork, it is not called after fork.
2019-06-29 14:36:14 -07:00
ridiculousfish
f58960ba01
Add a DIE("unreachable") in should_claim_process_group_for_job
...
Fixes a gcc warning.
2019-06-29 11:40:52 -07:00
ridiculousfish
f3736e8fdf
fish to claim a job's pgroup if the first process is fish internal
...
When executing a job, if the first process is fish internal, then have
fish claim the job's pgroup.
The idea here is that the terminal must be owned by a pgroup containing
the process reading from the terminal. If the first process is fish
internal (a function or builtin) then the pgroup must contain the fish
process.
This is a bit of a workaround of the behavior where the first process that
executes in a job becomes the process group leader. If there's a deferred
process, then we will execute processes out of order so the pgroup can be
wrong. Fix this by setting the process group leader explicitly as fish
when necessary.
Fixes #5855
2019-06-26 17:30:51 -07:00
ridiculousfish
89fb408eb6
Migrate some job flags into const properties struct
...
This helps clarify which parts of a job are mutable, and which are constant.
2019-06-23 12:42:44 -07:00
ridiculousfish
5362161343
Call tcsetgrp() in child processes again
...
25afc9b377
made this unnecessary by
having child processes wait for a signal after fork(), but this change
was later reverted. If we artificially slow down fish (e.g. with a sleep)
after the fork call, we see commands getting backgrounded by mistake.
Put back the tcsetgrp() call.
2019-06-23 12:42:44 -07:00
ridiculousfish
8255c01edb
Rename setup_child_process to child_setup_process
...
Try to name all functions called after fork with "child" prefix.
2019-06-23 12:42:44 -07:00
ridiculousfish
6ce85aebc6
Switch file_io_t to store a wcstring
...
We no longer use file_io_t after fork(). We don't need to use a malloc'd
string any more. Use a wcstring.
2019-06-09 17:43:25 -07:00
ridiculousfish
b478f877ee
Clean up g_fork_count
...
Make it static and atomic
2019-06-03 12:58:59 -07:00
Fabian Homborg
87971e1f2e
Widen the rest of the FLOGs
...
Fixes #5900 .
2019-05-30 13:08:35 +02:00
Fabian Homborg
d73ee4d54b
More using FLOGF when formatting is needed
...
sed-patched, every time a "%" is used in a call to `FLOG`, we use
`FLOGF` instead.
2019-05-30 11:54:09 +02:00
ridiculousfish
f3ee6a99c3
Add some FLOG logging around internal processes
2019-05-29 12:34:11 -07:00
Fabian Homborg
32949eefbe
src/exec: Use wide IO for FLOG
...
Another step towards #5900 .
2019-05-28 23:08:35 +02:00
ridiculousfish
835c6ffa67
clang-format all files
2019-05-27 19:47:13 -07:00
ridiculousfish
ea9d1ad82f
Convert debug(0) calls to FLOG
2019-05-27 17:31:17 -07:00
ridiculousfish
d9676bb2a8
Convert fork events from debug to flog
2019-05-27 17:24:52 -07:00
ridiculousfish
8774860468
Convert job logging from debug to FLOG
2019-05-27 17:24:52 -07:00
ridiculousfish
a5a5ccb73d
Revert "exec: If a job includes a builtin, it stays in our pgroup"
...
This reverts commit 711260593c
.
This ended up breaking the tests; moreover it may have other problems
like preventing backgrounding.
Reopens #5855
2019-05-24 18:00:31 -07:00
Fabian Homborg
711260593c
exec: If a job includes a builtin, it stays in our pgroup
...
Fixes #5855 .
2019-05-24 18:04:20 +02:00
ridiculousfish
4d929720ce
Clean up and rename io_transmorgrify
2019-05-22 16:36:22 -07:00
ridiculousfish
e91d68266c
Eliminate reader_current_filename
...
Store this in the parser libdata instead.
2019-05-22 13:51:27 -07:00
ridiculousfish
686b84396c
Migrate the return bool outside of block_t
...
This is a flag that gets set by the return function. But we only need one,
not per-block. Move it into libdata.
2019-05-22 13:51:27 -07:00
ridiculousfish
eff4873eca
Stop creating subclasses of block_t
...
Move all block_t creation methods to static methods, and stop creating
subclasses (all of which are now empty).
2019-05-19 14:40:35 -07:00
ridiculousfish
c42eb0eb4f
Remove the process from function_block_t
...
Prior to this fix, a function_block stored a process_t, which was only used
when printing backtraces. Switch this to an array of arguments, and make
various other cleanups around null terminated argument arrays.
2019-05-18 21:09:04 -07:00
ridiculousfish
508c3a8005
Make is_event and other globals part of parser_t libdata
2019-05-18 19:03:45 -07:00
ridiculousfish
4fcb9d1fed
Hide no_exec behind a function
2019-05-18 18:50:28 -07:00
ridiculousfish
1719d6f136
Make $status and $pipestatus per-parser
...
Another step towards allowing multiple parsers to execute in parallel.
2019-05-12 14:00:44 -07:00
ridiculousfish
16fd780484
Reimplement the whole variable stack
...
The variable stack is a mess - confused locking, surprising callouts, and
unclear division of labor. Just reimplement the whole thing.
2019-05-11 19:17:16 -07:00
ridiculousfish
8a8b2513b5
Eliminate the global jobs() function
...
All job lists are attached to a parser now.
2019-05-05 11:33:08 -07:00
Fabian Homborg
c2970f9618
Reformat all files
...
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.
If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
ridiculousfish
9fb98baba6
Thread the parser into process_clean_after_marking
2019-05-04 20:58:35 -07:00
ridiculousfish
b0a695e9fa
Migrate the global exec_count into the parser
2019-05-04 20:58:35 -07:00
ridiculousfish
acd33cbabb
Remove an unnecessary fetch of the principal parser
2019-05-04 16:56:38 -07:00
Mahmoud Al-Qudsi
8e4010b263
Make eval
override previous status
...
Closes #5692 (again).
2019-04-13 17:28:10 -05:00
Mahmoud Al-Qudsi
4530a41004
Fix return code after execution of empty function
2019-04-13 17:21:13 -05:00