isomorfeus-speednode 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3ece9e49e7a5105aef77b28b04445e4d39e2f22d061bfd1f03e43a79e403eb
|
4
|
+
data.tar.gz: e3d57e156c9d1efa686a18ae784125cc8c9d553e9946cabfd0c1325f20a959f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67a6b031a66b5b29a9db16924087dc013a4c0ce360edbc8c4db3c076766c6c31d00783472a7b6f4d6bde526c61602ff1a78cc4e343c142016ef183005dcb339c
|
7
|
+
data.tar.gz: c4600a01abe22631455c4dce5209f656409a7931b5295116a551420c03c78906b3d6733afac90ebc87ce3835c9af2228b35c1e3bdb86296dc5aac2ce93b4ecdd
|
@@ -132,6 +132,13 @@ CircularJSON.stringify = function stringify(value, replacer, space, doNotResolve
|
|
132
132
|
};
|
133
133
|
/*** end of circular-json ***/
|
134
134
|
|
135
|
+
// serialize Map as Object, also below in attach
|
136
|
+
function simple_map_replacer(key, value) {
|
137
|
+
if (value && typeof value === 'object' && value.constructor.name === "Map")
|
138
|
+
return Object.fromEntries(value);
|
139
|
+
return value;
|
140
|
+
}
|
141
|
+
|
135
142
|
function attachFunctionSource(responder_path, context, func) {
|
136
143
|
return `${func} = async function(...method_args) {
|
137
144
|
let context = '${context}';
|
@@ -158,8 +165,13 @@ function attachFunctionSource(responder_path, context, func) {
|
|
158
165
|
}, 10)
|
159
166
|
});
|
160
167
|
}
|
168
|
+
function simple_map_replacer(key, value) {
|
169
|
+
if (value && typeof value === 'object' && value.constructor.name === "Map")
|
170
|
+
return Object.fromEntries(value);
|
171
|
+
return value;
|
172
|
+
}
|
161
173
|
return new Promise(function(resolve, reject) {
|
162
|
-
let request_json = JSON.stringify(request);
|
174
|
+
let request_json = JSON.stringify(request, simple_map_replacer);
|
163
175
|
let buffer = Buffer.alloc(0);
|
164
176
|
let socket = net.connect(responder_path);
|
165
177
|
socket.setTimeout(2000);
|
@@ -228,18 +240,15 @@ function getContext(uuid) {
|
|
228
240
|
|
229
241
|
function getContextOptions(uuid) {
|
230
242
|
let options = { filename: "(execjs)", displayErrors: true };
|
231
|
-
if (contexts[uuid].options.timeout)
|
243
|
+
if (contexts[uuid].options.timeout)
|
232
244
|
options.timeout = contexts[uuid].options.timeout;
|
233
|
-
}
|
234
245
|
return options;
|
235
246
|
}
|
236
247
|
|
237
248
|
function massageStackTrace(stack) {
|
238
|
-
if (stack && stack.indexOf("SyntaxError") == 0)
|
249
|
+
if (stack && stack.indexOf("SyntaxError") == 0)
|
239
250
|
return "(execjs):1\n" + stack;
|
240
|
-
|
241
|
-
return stack;
|
242
|
-
}
|
251
|
+
return stack;
|
243
252
|
}
|
244
253
|
|
245
254
|
let socket_path = process.env.SOCKET_PATH;
|
@@ -384,9 +393,9 @@ let server = net.createServer(function(s) {
|
|
384
393
|
return;
|
385
394
|
}
|
386
395
|
|
387
|
-
try { outputJSON = JSON.stringify(result); }
|
396
|
+
try { outputJSON = JSON.stringify(result, simple_map_replacer); }
|
388
397
|
catch(err) {
|
389
|
-
if (err.message.includes('circular')) { outputJSON = CircularJSON.stringify(result); }
|
398
|
+
if (err.message.includes('circular')) { outputJSON = CircularJSON.stringify(result, simple_map_replacer); }
|
390
399
|
else { outputJSON = JSON.stringify([['', err].join(''), err.stack]); }
|
391
400
|
s.write([outputJSON, "\x04"].join(''));
|
392
401
|
if (process_exit !== false) { process.exit(process_exit); }
|
@@ -165,7 +165,7 @@ module Isomorfeus
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def await_result
|
168
|
-
start_time = Time.now
|
168
|
+
start_time = ::Time.now
|
169
169
|
while eval_script(key: :_internal_exec_fin) && !timed_out?(start_time)
|
170
170
|
sleep 0.005
|
171
171
|
end
|
@@ -193,7 +193,7 @@ module Isomorfeus
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def timed_out?(start_time)
|
196
|
-
if (Time.now - start_time) > @timeout
|
196
|
+
if (::Time.now - start_time) > @timeout
|
197
197
|
raise "IsomorfeusSpeednode: Command Execution timed out!"
|
198
198
|
end
|
199
199
|
false
|
@@ -5,7 +5,7 @@ if Gem.win_platform?
|
|
5
5
|
module Win32
|
6
6
|
class Pipe
|
7
7
|
def write(data)
|
8
|
-
bytes = FFI::MemoryPointer.new(:ulong)
|
8
|
+
bytes = ::FFI::MemoryPointer.new(:ulong)
|
9
9
|
|
10
10
|
raise Error, "no pipe created" unless @pipe
|
11
11
|
|
@@ -44,7 +44,7 @@ module Isomorfeus
|
|
44
44
|
attr_reader :responder
|
45
45
|
|
46
46
|
def initialize(options)
|
47
|
-
@mutex = Thread::Mutex.new
|
47
|
+
@mutex = ::Thread::Mutex.new
|
48
48
|
@socket_path = nil
|
49
49
|
@options = options
|
50
50
|
@started = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-speednode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|