command-stream 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/$.mjs +14 -0
package/package.json
CHANGED
package/src/$.mjs
CHANGED
|
@@ -766,6 +766,20 @@ function buildShellCommand(strings, values) {
|
|
|
766
766
|
valuesLength: values.length
|
|
767
767
|
}, null, 2)}`);
|
|
768
768
|
|
|
769
|
+
// Special case: if we have a single value with empty surrounding strings,
|
|
770
|
+
// and the value looks like a complete shell command, treat it as raw
|
|
771
|
+
if (values.length === 1 && strings.length === 2 &&
|
|
772
|
+
strings[0] === '' && strings[1] === '' &&
|
|
773
|
+
typeof values[0] === 'string') {
|
|
774
|
+
const commandStr = values[0];
|
|
775
|
+
// Check if this looks like a complete shell command (contains spaces and shell-safe characters)
|
|
776
|
+
const commandPattern = /^[a-zA-Z0-9_\-./=,+@:\s"'`$(){}<>|&;*?[\]~\\]+$/;
|
|
777
|
+
if (commandPattern.test(commandStr) && commandStr.trim().length > 0) {
|
|
778
|
+
trace('Utils', () => `BRANCH: buildShellCommand => COMPLETE_COMMAND | ${JSON.stringify({ command: commandStr }, null, 2)}`);
|
|
779
|
+
return commandStr;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
769
783
|
let out = '';
|
|
770
784
|
for (let i = 0; i < strings.length; i++) {
|
|
771
785
|
out += strings[i];
|