noderb 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/noderb_extension/noderb_process.c +23 -23
- data/lib/noderb/version.rb +1 -1
- metadata +2 -2
@@ -5,9 +5,9 @@
|
|
5
5
|
|
6
6
|
typedef struct {
|
7
7
|
NODERB_BASIC_HANDLE
|
8
|
-
uv_pipe_t*
|
9
|
-
uv_pipe_t*
|
10
|
-
uv_pipe_t*
|
8
|
+
uv_pipe_t* stdo;
|
9
|
+
uv_pipe_t* stdi;
|
10
|
+
uv_pipe_t* stde;
|
11
11
|
} nodeRb_process_handle;
|
12
12
|
|
13
13
|
typedef struct {
|
@@ -16,9 +16,9 @@ typedef struct {
|
|
16
16
|
|
17
17
|
void nodeRb_process_close(uv_handle_t* handle) {
|
18
18
|
nodeRb_process_handle* process_handle = (nodeRb_process_handle*) handle->data;
|
19
|
-
free(process_handle->
|
20
|
-
free(process_handle->
|
21
|
-
free(process_handle->
|
19
|
+
free(process_handle->stdi);
|
20
|
+
free(process_handle->stdo);
|
21
|
+
free(process_handle->stde);
|
22
22
|
free(process_handle);
|
23
23
|
free(handle);
|
24
24
|
}
|
@@ -34,7 +34,7 @@ VALUE nodeRb_process_write(VALUE self, VALUE data) {
|
|
34
34
|
// Get process handle
|
35
35
|
nodeRb_process_handle* process_handle = (nodeRb_process_handle*) handle->data;
|
36
36
|
// Write data to stream
|
37
|
-
nodeRb_write((uv_stream_t*) process_handle->
|
37
|
+
nodeRb_write((uv_stream_t*) process_handle->stdi, buffer, sizeof(buffer));
|
38
38
|
}
|
39
39
|
|
40
40
|
VALUE nodeRb_process_kill(VALUE self, VALUE signal) {
|
@@ -89,28 +89,28 @@ VALUE nodeRb_startProcess(VALUE self, VALUE executable, VALUE arguments, VALUE e
|
|
89
89
|
// Be safe of GC
|
90
90
|
nodeRb_register_instance(clazz);
|
91
91
|
// stdin
|
92
|
-
uv_pipe_t*
|
93
|
-
uv_pipe_init(uv_default_loop(),
|
94
|
-
options.stdin_stream =
|
95
|
-
process_handle->
|
92
|
+
uv_pipe_t* stdi = malloc(sizeof(uv_pipe_t));
|
93
|
+
uv_pipe_init(uv_default_loop(), stdi);
|
94
|
+
options.stdin_stream = stdi;
|
95
|
+
process_handle->stdi = stdi;
|
96
96
|
// stdout
|
97
|
-
uv_pipe_t*
|
98
|
-
uv_pipe_init(uv_default_loop(),
|
99
|
-
options.stdout_stream =
|
97
|
+
uv_pipe_t* stdo = malloc(sizeof(uv_pipe_t));
|
98
|
+
uv_pipe_init(uv_default_loop(), stdo);
|
99
|
+
options.stdout_stream = stdo;
|
100
100
|
nodeRb_process_read_handle* stdout_handle = malloc(sizeof(nodeRb_process_read_handle));
|
101
101
|
stdout_handle->target = process_handle->target;
|
102
102
|
stdout_handle->target_callback = (char*) "on_stdout";
|
103
|
-
|
104
|
-
process_handle->
|
103
|
+
stdo->data = stdout_handle;
|
104
|
+
process_handle->stdo = stdo;
|
105
105
|
// stderr
|
106
|
-
uv_pipe_t*
|
107
|
-
uv_pipe_init(uv_default_loop(),
|
108
|
-
options.stderr_stream =
|
106
|
+
uv_pipe_t* stde = malloc(sizeof(uv_pipe_t));
|
107
|
+
uv_pipe_init(uv_default_loop(), stde);
|
108
|
+
options.stderr_stream = stde;
|
109
109
|
nodeRb_process_read_handle* stderr_handle = malloc(sizeof(nodeRb_process_read_handle));
|
110
110
|
stderr_handle->target = process_handle->target;
|
111
111
|
stderr_handle->target_callback = (char*) "on_stderr";
|
112
|
-
|
113
|
-
process_handle->
|
112
|
+
stde->data = stderr_handle;
|
113
|
+
process_handle->stde = stde;
|
114
114
|
// libuv handle
|
115
115
|
uv_process_t* handle = malloc(sizeof(uv_process_t));
|
116
116
|
handle->data = process_handle;
|
@@ -119,8 +119,8 @@ VALUE nodeRb_startProcess(VALUE self, VALUE executable, VALUE arguments, VALUE e
|
|
119
119
|
// spawn process
|
120
120
|
uv_spawn(uv_default_loop(), handle, options);
|
121
121
|
// Listen to stdout/err
|
122
|
-
uv_read_start((uv_stream_t*)
|
123
|
-
uv_read_start((uv_stream_t*)
|
122
|
+
uv_read_start((uv_stream_t*) stdo, nodeRb_read_alloc, nodeRb_read);
|
123
|
+
uv_read_start((uv_stream_t*) stde, nodeRb_read_alloc, nodeRb_read);
|
124
124
|
// call back ruby
|
125
125
|
rb_funcall(clazz, rb_intern("on_start"), 0);
|
126
126
|
};
|
data/lib/noderb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noderb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-13 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Port of the NodeJs library to Ruby, featuring asynchronous IO operations
|
15
15
|
of all kinds.
|