Commit Graph

64 Commits

Author SHA1 Message Date
Shane Holloway
5d92ccce94 windows: add flag for hiding windows created by a spawned process
Closes GH-627
2012-11-27 16:48:46 +01:00
Bert Belder
9aead82537 windows: rename UV_HANDLE_CLOSING to UV__HANDLE_CLOSING 2012-09-13 23:42:07 +02:00
Bert Belder
abc945bc04 windows: make spawn with custom environment work again 2012-08-28 22:33:52 +02:00
Bert Belder
5c674b2889 windows: squelch some warnings related to int64 to int32 conversion 2012-08-28 22:33:52 +02:00
Bert Belder
637be161b3 windows: make active and closing handle state independent 2012-08-27 23:56:35 +02:00
Bert Belder
7c3ba514e7 windows: use WCHAR consistently 2012-08-13 22:31:48 +02:00
Bert Belder
aa69f34d53 windows: report spawn errors to the exit callback
Formerly spawn errors would be reported as a message printed to the
process' stderr, to match unix behaviour. Unix has now been fixed to
be more sensible, so this hack can now be removed.

This also fixes a race condition that could occur when the user closes
a process handle before the exit callback has been made.
2012-08-13 22:31:47 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Bert Belder
67090653df windows: set the child_pid property for all IPC pipes in uv_spawn 2012-06-19 19:22:49 +02:00
Bert Belder
07c6ac2b55 windows: move child stdio buffer ops to a separate file 2012-06-13 19:17:13 +02:00
Bert Belder
9f44b0e393 windows: fix serious typo in init_child_stdio 2012-06-13 01:30:43 +02:00
Ben Noordhuis
95e89c6a0e unix, windows: share uv__handle_init() 2012-06-13 01:28:58 +02:00
Bert Belder
b7e150ee91 windows: uv_kill() should report UV_ESRC when the victim is already dead 2012-06-12 17:00:16 +02:00
Bert Belder
be9d1ce909 windows: cast STARTUP_INFO.cbReserved2 to WORD to avoid warnings 2012-06-05 00:58:51 +02:00
Bert Belder
d8b95eaffb windows: inline a couple of handle functions 2012-06-02 23:38:16 +02:00
Bert Belder
d402604118 windows: inline a couple of inline request functions 2012-06-02 23:08:22 +02:00
Bert Belder
bdb8b3a1f2 windows: always set FDs 0-2 for spawned child processes 2012-06-02 21:17:03 +02:00
Bert Belder
619686e9e9 windows: fix fall-through bug in init_child_stdio() 2012-06-02 21:05:06 +02:00
Bert Belder
3ec9c67f93 windows: improve spawn stdio support
* Make using an existing stream for stdio actually work
* Support up to 256 stdio channels
* Fix some minor bugs
2012-06-01 17:47:20 +02:00
Fedor Indutny
f5b5127db0 change spawn() api to allow using existing streams for stdio
This commit also adds support for this api on Unix.
2012-06-01 17:32:27 +02:00
Charlie McConnell
69a923bf93 process: implement UV_PROCESS_DETACHED flag for uv_spawn 2012-06-01 02:24:05 +02:00
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