Konrad Borowski
3eac5f9ab7
Fix io_buffer_t::print to take unsigned long argument.
2013-11-25 16:10:14 +01: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
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
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
9f8fe3d5e3
Hopeful fix to avoid forking for certain builtins like echo when they have an input redirection only
2013-02-22 13:20:27 -08:00
Cheer Xiao
3f9706a7f3
Make io_data_t::fd const
...
In exec(), pipe_{write,read} no longer get reused.
2013-02-11 22:05:47 -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
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
e0c858478a
Revert "Make io_buffer_t::out_buffer a raw pointer, initialize in io_buffer_t's constructor"
...
This reverts commit d48ffab9d67da48cf45c2f5560c21a767144545f.
Conflicts:
io.cpp
io.h
2013-01-17 15:55:06 +08:00
Cheer Xiao
57ef5289fe
Make is_input a member of io_pipe_t
2013-01-17 15:55:06 +08:00
Cheer Xiao
a63c0311bb
Make io_buffer_t::out_buffer a raw pointer, initialize in io_buffer_t's constructor
2013-01-17 15:55:05 +08:00
Cheer Xiao
9808829ece
Make io_data_t pure virtual, its constructor protected
2013-01-17 15:55:05 +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
e020ad0c06
Convert io_buffer_read to io_buffer_t::read
2013-01-17 15:55:05 +08:00
Cheer Xiao
9057801c4b
Convert io_buffer_create to static io_buffer_t::create, make io_buffer_t constructor private
2013-01-17 15:55:05 +08:00
Cheer Xiao
0f443ef37b
Convert io_buffer_destroy to ~io_buffer_t
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
4b6bd7cae5
Split out io_file_t
2013-01-17 15:55:05 +08:00
Cheer Xiao
6f35792c74
Split out io_fd_t
2013-01-17 14:58:53 +08:00
Cheer Xiao
f1b375b042
Split out io_close_t
2013-01-17 14:58:53 +08:00
Cheer Xiao
165068c81d
Put io_data_t detail printing in virtual io_data_t::print
2013-01-17 14:58:53 +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
ridiculousfish
a79d3c680c
Remove io_duplicate, which is no longer used
2013-01-04 01:05:35 -08:00
ridiculousfish
ac023f7588
Replace some shared_ptrs with const shared_ptr &. Don't use shared_ptr in postfork.cpp. Eliminate copy constructor in io_data_t. Simplify some other uses of shared_ptr<io_data_t>
2013-01-04 00:22:12 -08:00
Cheer Xiao
8b10b0a614
Convert all io_data_t copying to shared_ptr copying.
...
Copy constructor of io_data_t is removed.
2013-01-01 00:37:50 +08:00
Cheer Xiao
a9ada13a23
Use shared_ptr to manage io_data_t*.
2012-12-31 23:54:17 +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
Łukasz Niemier
47df1ae40a
Remove trailing whitespaces and change tabs to spaces
2012-11-18 11:23:22 +01:00
ridiculousfish
9145d05397
Restore correct order of IO redirections
...
Fixes https://github.com/fish-shell/fish-shell/issues/281
2012-08-19 14:09:39 -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
ridiculousfish
d173bb6e0a
A bunch of changes working towards eliminating all memory allocation after fork()
2012-03-08 23:21:07 -08:00
ridiculousfish
191221eec5
Final cleanup of io_data_t now that I recognize the bizarre way in which it shares output buffers (not sure how this ever worked before)
2012-03-04 02:35:30 -08:00
ridiculousfish
27f374a38b
Some initial work on removing buffer_t from io_data_t
2012-03-03 23:56:35 -08:00
Siteshwar Vashisht
fd56465931
Fixed initialization of va_list variable in debug() in common.cpp, and mismatched new/free() in io.cpp
2012-02-23 23:10:51 +05:30
ridiculousfish
5fe7c065dc
Squash a bunch of leaks
2012-02-21 19:33:11 -08:00
ridiculousfish
e5ff5f7484
Some hopefully good changes to get IOs off of halloc
2012-02-09 18:43:36 -08:00
ridiculousfish
8d2f107d61
Some changes to migrate towards C++ and a multithreaded model
2011-12-26 19:18:46 -08:00
ridiculousfish
3f16ace678
Initial C++ conversion
2011-12-26 19:11:54 -08:00