Commit Graph

43 Commits

Author SHA1 Message Date
Ben Noordhuis
171ad8567d unix, windows: add uv_walk()
Lets the libuv user iterate over the open handles. Mostly intended as a
debugging tool or a post-hoc cleanup mechanism.
2012-05-30 02:33:39 +02:00
Bert Belder
7556590707 win/process.c: stdio fd should default to ignore 2012-05-29 00:53:04 +02:00
Bert Belder
81aff93633 win/process.c: remove unused function duplicate_std_handle 2012-05-29 00:06:11 +02:00
Igor Zinkovsky
5a34f19970 windows: allow specifying FDs to be inherited by a child process
Previously the only option was to create a pipe or an ipc channel. This
patch makes it possible to inherit a handle that is already open in the
parent process. There is also room for setting more than just stdin,
stdout and stderr, although this is not supported yet.
2012-05-28 23:59:58 +02:00
Ben Noordhuis
9efa8b3571 unix, windows: rework reference counting scheme
This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.

While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.

That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:

 * timers: ticking
 * sockets: reading, writing or listening
 * processes: always active (for now, subject to change)
 * idle, check, prepare: only active when started

This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.

The Windows implementation was done by Bert Belder.
2012-05-17 07:07:53 +02:00
Bert Belder
99a995a6b8 uv_spawn: support setting the child process' user and group id 2012-04-28 02:38:41 +02:00
Bert Belder
e99fba47c8 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/win/pipe.c
	test/run-tests.c
2012-03-09 16:41:12 +01:00
Bert Belder
87752ac38b Fold trailing whitespace 2012-03-09 05:00:09 +01:00
Ben Noordhuis
ec0eff955e Revert b3e0ad4, 149d32c, e99fdf0 and ea9baef.
Detaching doesn't work yet, the setsid() call fails and leaves the child process
attached to the parent's session.

Revert "test: Add test case for spawning detached child processes."
Revert "win: Implement options.detached for uv_spawn() for Windows."
Revert "unix: Implement options.detached for uv_spawn() for unix."
Revert "Add "detached" member to uv_process_options_t to denote whether a child
        process should spawn detached from its parent."

This reverts commit ea9baef95c.
This reverts commit e99fdf0df6.
This reverts commit 149d32cb96.
This reverts commit b3e0ad4db8.
2012-02-28 15:29:05 +01:00
Charlie McConnell
e99fdf0df6 win: Implement options.detached for uv_spawn() for Windows. 2012-02-24 15:15:00 +01:00
Bruce Mitchener
d513d9bb41 Fix typos. 2011-11-30 14:35:13 +01:00
Bert Belder
2b7774ae49 Windows: return UV_ESRCH from uv_kill 2011-11-09 01:48:04 +01:00
Igor Zinkovsky
82cf0b38c0 windows: remove quotes from PATH in uv_spawn 2011-11-04 15:08:53 -07:00
Igor Zinkovsky
ee8a681ace windows: uv_kill and uv_process_kill to terminate the process on SIGINT 2011-11-03 14:03:42 -07:00
Igor Zinkovsky
74b49e821b uv_kill 2011-11-02 14:34:07 -07:00
Ben Noordhuis
a3d495c0bc win: make uv_process_kill(proc, 0) report process status 2011-10-11 21:36:54 +02:00
Igor Zinkovsky
9f6024a6fa windows: fixes crash in pipe.c 2011-10-07 15:05:01 -07:00
Igor Zinkovsky
81c4043c83 ipc on windows 2011-10-06 10:17:42 -07:00
Erick Tryzelaar
23796d208c Fixes #76. Unify OS error reporting
As a nice fringe benefit, this also shaves a word
off of a windows TCP handle by replacing "uv_err_t
bind_error" with "int bind_error".
2011-09-27 19:05:33 -07:00
Ben Noordhuis
fbbc085448 Rename COUNTOF() to ARRAY_SIZE().
Consistent with Node, it has an ARRAY_SIZE() macro but not COUNTOF().
2012-01-18 15:48:31 +01:00
Igor Zinkovsky
ee115bfd8d windows: fail uv_spawn() if options.file is NULL 2011-09-19 16:03:38 -07:00
Bert Belder
c2741514bc win: fix spawn() bug 2011-09-08 18:01:42 +02:00
Bert Belder
3d538af06b win: correctly manage child process stdio handles 2011-09-06 03:20:16 +02:00
Bert Belder
78debf9f67 win: multiplicity 2011-08-31 04:19:16 +02:00
Bert Belder
811828719f win: store the tcp deferred bind error in uv_tcp_t.bind_error, remove uv_handle_t.error 2011-08-23 20:41:16 +02:00
Bert Belder
8ed2ffb2bf Windows: when searching path, look only for .com and .exe files 2011-08-18 04:08:27 +02:00
Igor Zinkovsky
fc26321890 use GetQueuedCompletionStatusEx if the OS supports it 2011-08-15 12:13:47 -07:00
Ryan Dahl
ee2027dd13 fix preprocessor again 2011-08-10 16:16:47 -07:00
Ryan Dahl
06623d15f2 More preprocessor fixes... 2011-08-10 15:01:38 -07:00
Ryan Dahl
dac30a15f2 More preprocessor fixes 2011-08-10 14:56:16 -07:00
Ryan Dahl
5dc8037fcf Fix mingw build by using preprocessor correctly. 2011-08-10 14:40:52 -07:00
Peter Bright
3409c9b383 Include important Windows environmental variables even when a blank/custom environment is specified. 2011-08-09 14:29:51 -07:00
Bert Belder
c834d5de9e Windows: correct comment in process.c 2011-08-05 08:22:01 +02:00
Peter Bright
d84b249616 Support for unescaped arguments, suitable for use with cmd /c.
Robust argument escaping that hopefully matches Windows' algorithm for unescaping.
2011-08-04 18:22:47 -07:00
Bert Belder
642d97ced8 Windows: make process arguments buffer computation better 2011-08-03 02:09:37 +02:00
Bert Belder
ec143961d1 Windows: fix bug in process arguments buffer size computation 2011-08-03 01:42:32 +02:00
Bert Belder
2e9a743da0 Windows: report uv_spawn() failure asynchronously 2011-08-01 20:24:54 -07:00
Igor Zinkovsky
0d29ea68c9 windows: fix for space in args 2011-08-01 16:41:08 -07:00
Igor Zinkovsky
5af7423f90 always use PATH from parent 2011-08-01 14:28:39 -07:00
Igor Zinkovsky
6c86f9e0a8 windows: get values of path and pathext env variables when they're not supplied 2011-08-01 13:40:48 -07:00
Igor Zinkovsky
1d6117a89b windows: set mode for child pipe handle 2011-07-30 10:55:30 -07:00
Igor Zinkovsky
d272a2183d Windows: spawn child processes 2011-07-29 19:02:51 -07:00
Igor Zinkovsky
fc7bc2be70 fix mingw build; add stubs for child process API 2011-07-27 11:05:32 -07:00