Skip to content

Commit 85f53a9

Browse files
committed
fix handling of single quotes in pipe #763
1 parent d9fda17 commit 85f53a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

js/pipe.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@
340340
return cmd.name + ' ' + cmd.args.map(function(arg, i) {
341341
if (cmd.args_quotes[i]) {
342342
var quote = cmd.args_quotes[i];
343-
return quote + unparse(arg) + quote;
343+
var result = unparse(arg);
344+
if (quote === '"' && result.match(/\\'/)) {
345+
result = result.replace(/\\'/g, "'");
346+
}
347+
return quote + result + quote;
344348
}
345349
if (typeof arg === 'string') {
346350
return arg.replace(/ /g, '\\ ');
@@ -392,7 +396,7 @@
392396
if (single_command(commands)) {
393397
var cmd = commands[0];
394398
if (is_function(interpreter)) {
395-
return interpreter.call(term, stringify(cmd), term);
399+
return interpreter.call(term, command, term);
396400
} else if (is_function(interpreter[cmd.name])) {
397401
return interpreter[cmd.name].apply(term, cmd.args);
398402
} else if ($.isPlainObject(interpreter[cmd.name])) {

0 commit comments

Comments
 (0)