Skip to content

Commit 2a8310e

Browse files
committed
fix shell escaping for remote sessions
1 parent 24fc074 commit 2a8310e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/connection/process/remote.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,27 +171,27 @@ export function get_ (path, args) {
171171
let exec = ''
172172
if (atom.config.get('julia-client.remoteOptions.tmux')) {
173173
let sessionName = atom.config.get('julia-client.remoteOptions.tmuxName')
174-
exec += '/bin/sh -c "'
174+
exec += '/bin/sh -c \''
175175
exec += `tmux new -s ${sessionName} \\"`
176176
if (threadCount() !== undefined) {
177177
exec += ` JULIA_NUM_THREADS='${threadCount()}' `
178178
}
179179
exec += jlpath
180-
exec += ' ' + args.join(' ') + ' -e \''
181-
exec += fs.readFileSync(paths.script('boot_repl.jl')).toString().replace(/"/g, '\\\\\\"')
182-
exec += '\' ' + port + ' \\" '
183-
exec += `|| tmux send-keys -t ${sessionName}.left ^A ^K ^H \'Juno.connect(${port})\' ENTER `
180+
exec += ' ' + args.join(' ') + ' -e \'\\\'\''
181+
exec += fs.readFileSync(paths.script('boot_repl.jl')).toString()
182+
exec += '\'\\\'\' ' + port + ' \\" '
183+
exec += `|| tmux send-keys -t ${sessionName}.left ^A ^K ^H \'\\\'\'Juno.connect(${port})\'\\\'\' ENTER `
184184
exec += `&& tmux attach -t ${sessionName} `
185-
exec += '"'
185+
exec += '\''
186186
} else {
187-
exec += '/bin/sh -c "'
187+
exec += '/bin/sh -c \''
188188
if (threadCount() !== undefined) {
189189
exec += `JULIA_NUM_THREADS='${threadCount()}' `
190190
}
191-
exec += jlpath + ' ' + args.join(' ') + ' -e \''
192-
exec += fs.readFileSync(paths.script('boot_repl.jl')).toString().replace(/"/g, '\\"')
193-
exec += '\' ' + port
194-
exec += '"'
191+
exec += jlpath + ' ' + args.join(' ') + ' -e \'\\\'\''
192+
exec += fs.readFileSync(paths.script('boot_repl.jl')).toString()
193+
exec += '\'\\\'\' ' + port
194+
exec += '\''
195195
}
196196

197197
conn.exec(exec, { pty: { term: "xterm-256color" } }, (err, stream) => {

script/boot_repl.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ try
4343
atom_outdated = """
4444
Please upgrade Atom.jl to at least version `$(MIN_REQUIRED_ATOM_JL_VERSION)` with e.g. `using Pkg; Pkg.update()`.
4545
46-
If Juno's integrated REPL is non-functional as a consequence of an old version of Atom.jl you will
46+
If the integrated REPL is non-functional as a consequence of an old version of Atom.jl you will
4747
need to update in a terminal, which you can open with e.g. the `Julia Client: Open A Repl` command.
4848
"""
4949
end

0 commit comments

Comments
 (0)