@@ -168,30 +168,41 @@ export function get_ (path, args) {
168
168
}
169
169
} )
170
170
let jlpath = atom . config . get ( 'julia-client.remoteOptions.remoteJulia' )
171
+
172
+ // construct something like
173
+ //
174
+ // /bin/sh -c 'tmux new -s sessionname '\'' julia -i -e '\'\\\'\''startup_repl'\'\\\'\'' '\''port'\'' '\'' '
175
+ //
176
+ // with properly escaped single quotes.
177
+
171
178
let exec = ''
172
179
if ( atom . config . get ( 'julia-client.remoteOptions.tmux' ) ) {
173
180
let sessionName = atom . config . get ( 'julia-client.remoteOptions.tmuxName' )
174
- exec += ' /bin/sh -c \''
175
- exec += `tmux new -s ${ sessionName } \\" `
181
+ exec += ` /bin/sh -c '`
182
+ exec += `tmux new -s ${ sessionName } '\\'' `
176
183
if ( threadCount ( ) !== undefined ) {
177
- exec += ` JULIA_NUM_THREADS=' ${ threadCount ( ) } ' `
184
+ exec += ` JULIA_NUM_THREADS=" ${ threadCount ( ) } " `
178
185
}
179
186
exec += jlpath
180
- exec += ' ' + args . join ( ' ' ) + ' -e \'\\\'\''
187
+ exec += ` ${ args . join ( ' ' ) } -e '\\'\\\\\\'\\''`
188
+ // could automatically escape single quotes with `replace(/'/, `'\\'\\\\\\'\\\\\\\\\\\\\\'\\\\\\'\\''`)`,
189
+ // but that's so ugly I'd rather not do that
181
190
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 `
191
+ exec += `'\\ '\\\\\\'\\'' ${ port } '\\'' `
192
+ exec += `|| tmux send-keys -t ${ sessionName } .left ^A ^K ^H '\\' 'Juno.connect(${ port } )'\\' ' ENTER `
184
193
exec += `&& tmux attach -t ${ sessionName } `
185
- exec += '\''
194
+ exec += `'`
186
195
} else {
187
- exec += ' /bin/sh -c \''
196
+ exec += ` /bin/sh -c '`
188
197
if ( threadCount ( ) !== undefined ) {
189
- exec += `JULIA_NUM_THREADS=' ${ threadCount ( ) } ' `
198
+ exec += `JULIA_NUM_THREADS=" ${ threadCount ( ) } " `
190
199
}
191
- exec += jlpath + ' ' + args . join ( ' ' ) + ' -e \'\\\'\''
200
+ exec += `${ jlpath } ${ args . join ( ' ' ) } -e '\\''`
201
+ // could automatically escape single quotes with `replace(/'/, `'\\'\\\\\\'\\''`)`,
202
+ // but that's so ugly I'd rather not do that
192
203
exec += fs . readFileSync ( paths . script ( 'boot_repl.jl' ) ) . toString ( )
193
- exec += '\'\\\'\' ' + port
194
- exec += '\''
204
+ exec += `'\\'' ${ port } `
205
+ exec += `'`
195
206
}
196
207
197
208
conn . exec ( exec , { pty : { term : "xterm-256color" } } , ( err , stream ) => {
0 commit comments