fix shell escaping issues in Tmux#set_buffer
This commit is contained in:
parent
77b41be413
commit
9292a4a830
16
src/tmux.cr
16
src/tmux.cr
|
@ -197,7 +197,21 @@ class Tmux
|
||||||
def set_buffer(value)
|
def set_buffer(value)
|
||||||
return unless value
|
return unless value
|
||||||
|
|
||||||
exec(["set-buffer", value].join(' '))
|
# To avoid shell escaping nightmares, we'll use Process and write directly to stdin
|
||||||
|
cmd = Process.new(
|
||||||
|
tmux,
|
||||||
|
["load-buffer", "-w", "-"],
|
||||||
|
input: :pipe,
|
||||||
|
output: :pipe,
|
||||||
|
error: :pipe,
|
||||||
|
)
|
||||||
|
|
||||||
|
cmd.input.print(value)
|
||||||
|
cmd.input.flush
|
||||||
|
|
||||||
|
cmd.close
|
||||||
|
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_pane(id)
|
def select_pane(id)
|
||||||
|
|
Loading…
Reference in New Issue