File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments