arql 0.1.25 → 0.1.26

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5129e08083a8abbbed19d1fc8e37d6c1cb5ec82116eb4915574ccf51fbab4604
4
- data.tar.gz: 1743d1604a65793c6e36fa85ba1b6cc967a1b626bc2e0c6fb5e66611a9cec6d0
3
+ metadata.gz: 2ed88946e69a6690211fae5d85975ee9674f67cf865cbd8cc472f91cb053f5e6
4
+ data.tar.gz: 44d68d0a13e023c5c69402f92a07fe356fd234a73ba3664becfc17c916c95815
5
5
  SHA512:
6
- metadata.gz: bacfc17e2ddeb7791d6985a990fef8e1eec38a20f4073d6b2b878f0cbeacbcf1fd75b6e326b178d6c7767034810af11720bd1b6324bd5b22c817ee1d60cb79fe
7
- data.tar.gz: c35ad64535fcd18840882ab2c415a68a6899db0227ed47a490560548972f2b5a1cb0533842f1d4f6714ce7b37e3c1b6605dbfb34a48090dc6cb12aca76af46bd
6
+ metadata.gz: 25a93383de5e12ec51a1b7986aeec653b0d7c54c75863deff606487ac4a07ee0baec5b52d56f9562900d91e74f14e964ee0d52662b45a02236cc9cb5ca2c9aa6
7
+ data.tar.gz: 5fafcbe5ed60878e8614cacff2147eb0d29c58e39a30e4ca85e8c2d6d74d7ee2b70fabee880f275a3ae8194df5aa6d3c857396b3930ecb36d1f84087f348f1cd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.1.25)
4
+ arql (0.1.26)
5
5
  activerecord (~> 6.0.3)
6
6
  activesupport (~> 6.0.3)
7
7
  mysql2 (~> 0.5.3)
data/exe/arql CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ ArqlSetsidWrrapper = File.dirname(File.absolute_path(__FILE__)) + '/arql_setsid_wrapper'
4
+
3
5
  require "arql"
4
6
 
5
7
  Arql::Cli.start
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Process.setsid
4
+
5
+ exec(*ARGV)
@@ -1,4 +1,5 @@
1
1
  require 'net/ssh/gateway'
2
+ require 'arql/ssh_proxy_patch'
2
3
 
3
4
  module Arql
4
5
  class SSHProxy
@@ -0,0 +1,88 @@
1
+ require 'net/ssh/proxy/command'
2
+
3
+ module Net
4
+ module SSH
5
+ module Proxy
6
+ class Command
7
+
8
+ # Return a new socket connected to the given host and port via the
9
+ # proxy that was requested when the socket factory was instantiated.
10
+ def open(host, port, connection_options = nil)
11
+ command_line = @command_line_template.gsub(/%(.)/) {
12
+ case $1
13
+ when 'h'
14
+ host
15
+ when 'p'
16
+ port.to_s
17
+ when 'r'
18
+ remote_user = connection_options && connection_options[:remote_user]
19
+ if remote_user
20
+ remote_user
21
+ else
22
+ raise ArgumentError, "remote user name not available"
23
+ end
24
+ when '%'
25
+ '%'
26
+ else
27
+ raise ArgumentError, "unknown key: #{$1}"
28
+ end
29
+ }
30
+ command_line = '%s %s' % [ArqlSetsidWrrapper, command_line]
31
+ begin
32
+ io = IO.popen(command_line, "r+")
33
+ begin
34
+ if result = IO.select([io], nil, [io], @timeout)
35
+ if result.last.any? || io.eof?
36
+ raise "command failed"
37
+ end
38
+ else
39
+ raise "command timed out"
40
+ end
41
+ rescue StandardError
42
+ close_on_error(io)
43
+ raise
44
+ end
45
+ rescue StandardError => e
46
+ raise ConnectError, "#{e}: #{command_line}"
47
+ end
48
+ @command_line = command_line
49
+ if Gem.win_platform?
50
+ # read_nonblock and write_nonblock are not available on Windows
51
+ # pipe. Use sysread and syswrite as a replacement works.
52
+ def io.send(data, flag)
53
+ syswrite(data)
54
+ end
55
+
56
+ def io.recv(size)
57
+ sysread(size)
58
+ end
59
+ else
60
+ def io.send(data, flag)
61
+ begin
62
+ result = write_nonblock(data)
63
+ rescue IO::WaitWritable, Errno::EINTR
64
+ IO.select(nil, [self])
65
+ retry
66
+ end
67
+ result
68
+ end
69
+
70
+ def io.recv(size)
71
+ begin
72
+ result = read_nonblock(size)
73
+ rescue IO::WaitReadable, Errno::EINTR
74
+ timeout_in_seconds = 20
75
+ if IO.select([self], nil, [self], timeout_in_seconds) == nil
76
+ raise "Unexpected spurious read wakeup"
77
+ end
78
+ retry
79
+ end
80
+ result
81
+ end
82
+ end
83
+ io
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.1.25"
2
+ VERSION = "0.1.26"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-01 00:00:00.000000000 Z
11
+ date: 2020-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -169,6 +169,7 @@ email:
169
169
  - liuxiang921@gmail.com
170
170
  executables:
171
171
  - arql
172
+ - arql_setsid_wrapper
172
173
  extensions: []
173
174
  extra_rdoc_files: []
174
175
  files:
@@ -183,6 +184,7 @@ files:
183
184
  - bin/console
184
185
  - bin/setup
185
186
  - exe/arql
187
+ - exe/arql_setsid_wrapper
186
188
  - lib/arql.rb
187
189
  - lib/arql/app.rb
188
190
  - lib/arql/cli.rb
@@ -205,6 +207,7 @@ files:
205
207
  - lib/arql/multi_io.rb
206
208
  - lib/arql/repl.rb
207
209
  - lib/arql/ssh_proxy.rb
210
+ - lib/arql/ssh_proxy_patch.rb
208
211
  - lib/arql/version.rb
209
212
  homepage: https://github.com/lululau/arql
210
213
  licenses: