isomorfeus-speednode 0.4.0 → 0.4.1

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: 9ae800090e3226f94d53570baf613f33123e4f95bbb3e384b33d373a17328b60
4
- data.tar.gz: 3036d03ea6149df04d5cb53c6d2058893e6d2a61a2ea96f0a24c1d3b694705a0
3
+ metadata.gz: 1bb65853d666ae62943ed28b887dc6792c83c34bd7ed090d7bc817a42e40c63e
4
+ data.tar.gz: '0227178ecf8760e07f32043beba064258da9efa6baa221c96b0437ee12a6fc80'
5
5
  SHA512:
6
- metadata.gz: 13ccaa36e365de0b48dbc5124f8f4ff3ef123ca2177d745c895828aa5037c2d6dba1510803cb2434358117ddd3824c854bc3a44df72c5ca684176077f109c3c8
7
- data.tar.gz: e66f98d834d55218c99744b66bde19a680506fd543093e1a0316234480aa46c880262cf33f16cc3722df6a31255c4f8059f4914e4ce40d9485de4233d7aeb282
6
+ metadata.gz: ee26a18eb0e0209f543ce01cf240824edd3d00c8590a57c72a0422680c48127318a4111f7417f424b48ae8ffbc72b43c3bac7c03da8ee62baa265a49880471e8
7
+ data.tar.gz: a9da737b51f2b115bac2c218d2abc0618b443daa2cc2cd380991a30b4b4a998cb6c2497356d30279f04e717c86cf61a557173506b19859b711ca895a10880d75
@@ -312,10 +312,12 @@ let server = net.createServer(function(s) {
312
312
  if (err.message.includes('circular')) { outputJSON = CircularJSON.stringify(result); }
313
313
  else { outputJSON = JSON.stringify([['', err].join(''), err.stack]); }
314
314
  s.write([outputJSON, "\x04"].join(''));
315
+ if (process_exit !== false) { process.exit(process_exit); }
315
316
  return;
316
317
  }
317
318
 
318
- s.write([outputJSON, "\x04"].join(''));
319
+ try { s.write([outputJSON, "\x04"].join('')); }
320
+ catch (err) {}
319
321
  if (process_exit !== false) { process.exit(process_exit); }
320
322
  });
321
323
  });
@@ -57,7 +57,7 @@ module Isomorfeus
57
57
 
58
58
  def self.finalize(socket, socket_dir, socket_path, pid)
59
59
  proc do
60
- Isomorfeus::Speednode::Runtime.responders(socket_path).kill if Isomorfeus::Speednode::Runtime.responders(socket_path)
60
+ Isomorfeus::Speednode::Runtime.responders[socket_path].kill if Isomorfeus::Speednode::Runtime.responders[socket_path]
61
61
  exit_node(socket, socket_dir, socket_path, pid)
62
62
  end
63
63
  end
@@ -65,14 +65,18 @@ module Isomorfeus
65
65
  def self.exit_node(socket, socket_dir, socket_path, pid)
66
66
  VMCommand.new(socket, "exit", [0]).execute
67
67
  socket.close
68
- File.unlink(socket_path)
69
- Dir.rmdir(socket_dir)
68
+ File.unlink(socket_path) if File.exist?(socket_path)
69
+ Dir.rmdir(socket_dir) if socket_dir && Dir.exist?(socket_dir)
70
70
  if Gem.win_platform?
71
71
  # SIGINT or SIGKILL are unreliable on Windows, try native taskkill first
72
- Process.kill('KILL', pid) unless system("taskkill /f /t /pid #{pid} >NUL 2>NUL")
72
+ unless system("taskkill /f /t /pid #{pid} >NUL 2>NUL")
73
+ Process.kill('KILL', pid) rescue nil
74
+ end
73
75
  else
74
- Process.kill 'KILL', pid
76
+ Process.kill('KILL', pid) rescue nil
75
77
  end
78
+ rescue
79
+ nil
76
80
  end
77
81
 
78
82
  def eval(context, source)
@@ -159,6 +163,7 @@ module Isomorfeus
159
163
  end
160
164
 
161
165
  ObjectSpace.define_finalizer(self, self.class.finalize(@socket, @socket_dir, @socket_path, @pid))
166
+ Kernel.at_exit { self.class.finalize(@socket, @socket_dir, @socket_path, @pid).call }
162
167
  end
163
168
 
164
169
  def create_responder(context)
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Speednode
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs