Commit Graph

81 Commits

Author SHA1 Message Date
David Adam
a8059c5962 Solaris build fixes: pick the right curses more of the time 2014-12-21 23:37:23 +08:00
ridiculousfish
9382dc32df Remove an incorrect comment 2014-11-03 11:33:22 -08:00
ridiculousfish
6db82c162c Clean up some job status messages
Stop printing anything for jobs terminated via ^C.
Don't list the job number if it's the only job.

Fixes #1119
2014-11-03 10:56:16 -08:00
ridiculousfish
b0e09303a6 Reintroduce "Stop reaping children from SIGCHLD handler"
This re-introduces 3fe1069219
with some associated fixes to address #1768.
2014-10-25 16:51:25 -07:00
ridiculousfish
315ff1e712 Revert "Stop reaping children from SIGCHLD signal handler"
This reverts commit 3fe1069219.

In light of #1768
2014-10-21 11:33:22 -07:00
ridiculousfish
21a751d153 Revert "Remove some previously buggy but dead code that I mistakenly resurrected"
This reverts commit 090f027de1.
2014-10-21 11:33:12 -07:00
ridiculousfish
090f027de1 Remove some previously buggy but dead code that I mistakenly resurrected 2014-10-20 21:47:29 -07:00
ridiculousfish
3fe1069219 Stop reaping children from SIGCHLD signal handler
Prior to this fix, a child process may be reaped in one of two ways:
1. By a call to waitpid() within job_continue
2. By a call to waitpid() within the SIGCHLD signal handler

Only the second call was with the WNOHANG option. Thus if the signal
handler fired first, and then the waitpid call fired, we could get a
deadlock because we'd end up waiting on a long-running process. I have
not been able to reproduce this on fish 1.x, though it seems like it
ought to reproduce there too.

This fix migrates the waitpid() call out of the signal handler; the
second class of calls moves to job_reap. This eliminates the possibility
of a race, because we check for job completion before calling waitpid,
and there is no longer the possibility of the job being marked as
complete asynchronously. It also results in a massive conceptual
simplification, since the signal handler is now very simple and easy to
reason about (no more walking jobs lists, etc).

This partially fixes a bug reported in #1273
2014-10-20 15:50:54 -07:00
ridiculousfish
495adee269 Don't sanity_lose if INTERNAL_BLOCK_NODEs have a null argv
Fixes #1545
2014-07-12 11:01:00 -07:00
ridiculousfish
4948508277 Squelch some more warnings on Linux 2014-04-27 18:27:34 -07:00
ridiculousfish
58ebdd4a7e Attempt to silence some warnings 2014-04-27 17:23:19 -07:00
Konrad Borowski
36ef521c0e Fix filehandle leak in proc_get_jiffies 2014-04-26 17:36:20 +02:00
ridiculousfish
53814983ff Update style and formatting to conform to fish style guide. 2014-01-15 01:40:40 -08:00
ridiculousfish
993148552e Support for Ctrl-C cancellation in new parser. Added tests for it too. 2014-01-02 16:19:33 -08:00
ridiculousfish
fb882f0b69 Support for stack overflow and infinite recursion detection in new
parser
2014-01-01 15:29:56 -08:00
ridiculousfish
7356a0f6c8 Clean up and rationalize error handling in parse_execution.cpp 2013-12-31 14:37:37 -08:00
ridiculousfish
924b8cbe24 New ideas about how to use new parser for execution. Beginnings of
implementation.
2013-12-26 12:24:00 -08:00
ridiculousfish
739e529416 Initial flailing around trying to adopt new parser for actual execution 2013-12-20 14:37:40 -08:00
ridiculousfish
4aaa9e7d9f Allow autosuggestions to do job expansion. Fixes
https://github.com/fish-shell/fish-shell/issues/1152
2013-11-29 13:34:03 -08:00
ridiculousfish
4899086b3c Big fat refactoring of how redirections work. In fish 1.x and 2.0.0, the redirections for a process were flattened into a big list associated with the job, so there was no way to tell which redirections applied to each process. Each process therefore got all the redirections associated with the job. See https://github.com/fish-shell/fish-shell/issues/877 for how this could manifest.
With this change, jobs only track their block-level redirections. Process level redirections are correctly associated with the process, and at exec time we stitch them together (block, pipe, and process redirects).

This fixes the weird issues where redirects bleed across pipelines (like #877), and also allows us to play with the order in which redirections are applied, since the final list is constructed right before it's needed.  This lets us put pipes after block level redirections but before process level redirections, so that a 2>&1-type redirection gets picked up after the pipe, i.e. it should fix https://github.com/fish-shell/fish-shell/issues/110

This is a significant change. The tests all pass. Cross your fingers.
2013-08-19 18:06:24 -07:00
ridiculousfish
f4f2847662 Trivial cleanup of a function in proc.cpp 2013-08-19 18:06:24 -07:00
ridiculousfish
e849beabba Initial work towards various IO cleanups with an eye to fixing https://github.com/fish-shell/fish-shell/issues/110 2013-08-19 18:06:24 -07:00
ridiculousfish
5d75ee7721 Mark jobs as completed when all processes have finished, not just the last one.
Fixes https://github.com/fish-shell/fish-shell/issues/876 , and coincidentally also https://github.com/fish-shell/fish-shell/issues/848
2013-06-16 02:53:53 -07:00
ridiculousfish
2da81b0ae7 Formatting and style updates 2013-05-05 02:33:17 -07:00
ridiculousfish
3f172d13b2 Add thread assertion to proc_set_last_status 2013-04-07 14:38:57 -07:00
ridiculousfish
437b4397b9 Mark stdin as nonblocking if we get EWOULDBLOCK, and before handing it off to child processes when either starting them or moving them to the foreground.
https://github.com/fish-shell/fish-shell/issues/176
2013-04-07 12:40:08 -07:00
David Adam (zanchey)
daf5ef1bbd Kill termio.h and sys/termios.h
On FreeBSD, compilation complains that "this file includes
<sys/termios.h> which is deprecated, use <termios.h> instead". On Linux
and FreeBSD, <sys/termios.h> literally just pulls in <termios.h>. On OS
X and Solaris, <termios.h> pulls in <sys/termios.h>.

<termio.h> doesn't exist on FreeBSD or Mac OS X, and on Linux is marked
as deprecated and just includes <termios.h>. It does exist on Solaris,
but no `struct termio` is ever actually used in the codebase.
2013-03-05 12:25:00 -08:00
ridiculousfish
ad8d68dd43 Make subcommands modify $status, and make builtin_set not modify status unless it fails
https://github.com/fish-shell/fish-shell/issues/547
https://github.com/fish-shell/fish-shell/issues/214
2013-01-31 15:57:08 -08:00
ridiculousfish
3f8baeba20 Attempt to further improve fish's handling when it runs out of fds, and plug some fd leaks 2013-01-30 03:08:06 -08:00
ridiculousfish
1879dc4b59 Initial set of changes working to make fish robust against running out of file descriptors 2013-01-30 02:22:38 -08:00
Cheer Xiao
8f045b9ec5 Fix spelling: s/circut/circuit/g 2013-01-24 19:20:06 +08:00
ridiculousfish
98a17f4046 Remove some functions which were rendered trivial by xiaq's changes. Make io_file_t take its path directly. Make io_buffer_t no longer use a shared_ptr for its data. 2013-01-19 10:59:43 -08:00
Cheer Xiao
00b6431ad9 Split out io_pipe_t, let io_buffer_t inherit it 2013-01-17 15:55:05 +08:00
Cheer Xiao
a20e0b9e2e Split out io_buffer_t, make input_redirect in exec() a raw pointer 2013-01-17 15:55:05 +08:00
Cheer Xiao
b66233de78 Revert "Revert shared_ptr<io_data_t> changes until kinks are ironed out"
This reverts commit 77f1b1f0fe.
2013-01-11 14:18:10 -08:00
ridiculousfish
77f1b1f0fe Revert shared_ptr<io_data_t> changes until kinks are ironed out
https://github.com/fish-shell/fish-shell/pull/487

Revert "Merge branch 'oo-io' of git://github.com/xiaq/fish-shell into xiaq-oo-io"

This reverts commit f3c8f535a4, reversing
changes made to b02f6cf3bc.

Also reverts ac023f7588 and a79d3c680c
2013-01-04 02:05:30 -08:00
Cheer Xiao
a9ada13a23 Use shared_ptr to manage io_data_t*. 2012-12-31 23:54:17 +08:00
ridiculousfish
8a66ba6c35 Merge branch 'event-bug-test' of git://github.com/JanKanis/fish-shell into JanKanis-event-bug-test 2012-12-22 12:20:41 -08:00
Jan Kanis
71233ee894 Make event_t.arguments into a vector instead of an auto_ptr<vector>.
Yay for less indirection and less code! The resulting event_t structure is two pointers larger, but cuts out an indirection and allocation.
2012-12-20 16:13:14 +01:00
Cheer Xiao
09b1eee5d0 Random fixes to comments. 2012-12-16 12:23:24 +08:00
ridiculousfish
26678682ca Fix indentation of switch statements 2012-11-19 00:31:03 -08:00
ridiculousfish
9992b8eb0e Apply new indentation, brace, and whitespace style 2012-11-18 16:30:30 -08:00
ridiculousfish
c9c2fc5ee3 Restore terminal foreground process group on exit
Fixes https://github.com/fish-shell/fish-shell/issues/197
2012-11-18 02:16:14 -08:00
ridiculousfish
8c24d49c73 Removed unused commented out code and fixed some indentation 2012-11-04 15:47:55 -08:00
ridiculousfish
5e371e8fe7 Don't use posix_spawn for commands that need to be put into foreground to avoid a race
Fix for race where a command's output may not be fully drained
2012-11-04 15:45:52 -08:00
ridiculousfish
425afa63ce Don't use posix_spawn when file redirections are involved (except /dev/null) because the error handling is too difficult
Fix exec to correctly handle the case where a pid could not be created due to posix_spawn failing
Should fix https://github.com/fish-shell/fish-shell/issues/364
2012-10-29 01:45:51 -07:00
ridiculousfish
b67526aae8 Don't reset the terminal mode in certain circumstances. Fixes issue in Linux with e.g. echo foo ; ftp
Introduce patch from 9d229cd18c
2012-10-05 18:23:38 -07:00
ridiculousfish
cc1395797e First stab at elseif implementation 2012-09-01 01:46:14 -07:00
ridiculousfish
61686aff34 Adopt posix_spawn (!)
Rewrite IO chains to be a vector of pointers, instead of a linked list
Removed io_transmogrify
2012-08-15 00:57:56 -07:00
ridiculousfish
c67702a498 Cleaned up lots of typecasts, simplified some string handling 2012-08-04 15:11:43 -07:00