Browse Source

fix: preserve argument boundaries in run command (#4979)

Simon D'Morias 2 months ago
parent
commit
be8116e2ea
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/opencode/src/cli/cmd/run.ts

+ 3 - 1
packages/opencode/src/cli/cmd/run.ts

@@ -88,7 +88,9 @@ export const RunCommand = cmd({
       })
       })
   },
   },
   handler: async (args) => {
   handler: async (args) => {
-    let message = [...args.message, ...(args["--"] || [])].join(" ")
+    let message = [...args.message, ...(args["--"] || [])]
+      .map((arg) => (arg.includes(" ") ? `"${arg.replace(/"/g, '\\"')}"` : arg))
+      .join(" ")
 
 
     const fileParts: any[] = []
     const fileParts: any[] = []
     if (args.file) {
     if (args.file) {