actually support command substitutions in strToArgs

This commit is contained in:
Lisa Milne 2023-11-11 18:03:37 +10:00
parent 5246630d6f
commit 2a91fce083

View file

@ -1355,7 +1355,7 @@ clite.lib = {
path = '/'+parts.join('/');
return path;
},
// convert a string into an argument array: 'ls /etc' -> ['ls','/etc']
// convert a string into an argument array: 'ls /etc' -> ['ls','/etc'], supports "quoted arguments" and `command substitutions`
strToArgs:function(txt) {
var parts = [];
var sp = '';
@ -1377,8 +1377,12 @@ clite.lib = {
if (!q) {
sp = txt[i];
q = true;
if (sp == '`');
s += '`';
break;
}else if (txt[i] == sp) {
if (sp == '`');
s += '`';
sp = '';
q = false;
}