There was an error while loading. Please reload this page.
1 parent 171d78a commit 018abc1Copy full SHA for 018abc1
lib/resty/shell.lua
@@ -19,10 +19,19 @@ function shell.execute(cmd, args)
19
local input_data = args and args.data or ""
20
local socket = args and args.socket or default_socket
21
22
- local is_tcp = true
23
- if (find(socket, "unix:", 1, true)) then
24
- is_tcp = false
25
- end
+ local is_tcp
+
+ if (type(socket) == 'table') then
+ if (socket.host and socket.port) then
26
+ is_tcp = true
27
+ else
28
+ return -3, nil, 'invalid socket table options passed'
29
+ end
30
+ elseif (type(socket) == 'string') then
31
+ is_tcp = false
32
33
+ return -3, nil, 'socket was not a table with tcp options or a string'
34
35
36
local sock = tcp()
37
local ok, err
0 commit comments