Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
echo "uutils WASM build: ${commit_short} (${commit_date})"

- name: Upload uutils WASM artifact
uses: actions/upload-artifact@v8
uses: actions/upload-artifact@v7
with:
name: wasm-coreutils
path: wasm-out
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
echo "${{ matrix.name }} WASM build: ${s} (${d})"

- name: Upload ${{ matrix.name }} WASM artifact
uses: actions/upload-artifact@v8
uses: actions/upload-artifact@v7
with:
name: wasm-${{ matrix.name }}
path: wasm-out
Expand Down Expand Up @@ -389,7 +389,7 @@ jobs:
run: rm -f public/js/wasm-terminal.test.html

- name: Upload artifact for checking the output
uses: actions/upload-artifact@v8
uses: actions/upload-artifact@v7
with:
path: ./public

Expand Down
20 changes: 20 additions & 0 deletions static/js/wasm-terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,30 @@ async function executeCommandLine(line) {
}

try {
// sed's script argument is a program, not a path — it must NOT go through
// resolvePath, which normalizes path segments and would strip a trailing
// delimiter (e.g. `s/world/there/` -> `s/world/there`, breaking the `s`
// command). Collect the indices of any sed script arguments to skip.
const sedScriptIndices = new Set();
if (cmd === "sed") {
let scriptFromFlag = false;
for (let i = 1; i < args.length; i++) {
const a = args[i];
if (a === "-e" || a === "-f") { sedScriptIndices.add(i + 1); scriptFromFlag = true; i++; continue; }
if (a.startsWith("-e") || a.startsWith("-f")) { scriptFromFlag = true; } // combined form, e.g. -e's/a/b/'
}
// Without -e/-f, the script is the first non-option argument.
if (!scriptFromFlag) {
for (let i = 1; i < args.length; i++) {
if (!args[i].startsWith("-")) { sedScriptIndices.add(i); break; }
}
}
}
// Resolve relative paths using the virtual cwd
const resolvedArgs = args.map((arg, i) => {
if (i === 0) return arg; // command name
if (arg.startsWith("-")) return arg; // flag
if (sedScriptIndices.has(i)) return arg; // sed script, not a path
return resolvePath(arg);
});
// If the command takes a default path (like ls) and no path args
Expand Down