Skip to content

Commit 4b4be7e

Browse files
authored
Merge pull request #57 from uutils/fix-upload-artifact-v7
ci: fix upload-artifact version (v8 does not exist)
2 parents 15a745e + 6cb56f1 commit 4b4be7e

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/website.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
echo "uutils WASM build: ${commit_short} (${commit_date})"
114114
115115
- name: Upload uutils WASM artifact
116-
uses: actions/upload-artifact@v8
116+
uses: actions/upload-artifact@v7
117117
with:
118118
name: wasm-coreutils
119119
path: wasm-out
@@ -214,7 +214,7 @@ jobs:
214214
echo "${{ matrix.name }} WASM build: ${s} (${d})"
215215
216216
- name: Upload ${{ matrix.name }} WASM artifact
217-
uses: actions/upload-artifact@v8
217+
uses: actions/upload-artifact@v7
218218
with:
219219
name: wasm-${{ matrix.name }}
220220
path: wasm-out
@@ -389,7 +389,7 @@ jobs:
389389
run: rm -f public/js/wasm-terminal.test.html
390390

391391
- name: Upload artifact for checking the output
392-
uses: actions/upload-artifact@v8
392+
uses: actions/upload-artifact@v7
393393
with:
394394
path: ./public
395395

static/js/wasm-terminal.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,30 @@ async function executeCommandLine(line) {
638638
}
639639

640640
try {
641+
// sed's script argument is a program, not a path — it must NOT go through
642+
// resolvePath, which normalizes path segments and would strip a trailing
643+
// delimiter (e.g. `s/world/there/` -> `s/world/there`, breaking the `s`
644+
// command). Collect the indices of any sed script arguments to skip.
645+
const sedScriptIndices = new Set();
646+
if (cmd === "sed") {
647+
let scriptFromFlag = false;
648+
for (let i = 1; i < args.length; i++) {
649+
const a = args[i];
650+
if (a === "-e" || a === "-f") { sedScriptIndices.add(i + 1); scriptFromFlag = true; i++; continue; }
651+
if (a.startsWith("-e") || a.startsWith("-f")) { scriptFromFlag = true; } // combined form, e.g. -e's/a/b/'
652+
}
653+
// Without -e/-f, the script is the first non-option argument.
654+
if (!scriptFromFlag) {
655+
for (let i = 1; i < args.length; i++) {
656+
if (!args[i].startsWith("-")) { sedScriptIndices.add(i); break; }
657+
}
658+
}
659+
}
641660
// Resolve relative paths using the virtual cwd
642661
const resolvedArgs = args.map((arg, i) => {
643662
if (i === 0) return arg; // command name
644663
if (arg.startsWith("-")) return arg; // flag
664+
if (sedScriptIndices.has(i)) return arg; // sed script, not a path
645665
return resolvePath(arg);
646666
});
647667
// If the command takes a default path (like ls) and no path args

0 commit comments

Comments
 (0)