Skip to content

Commit

Permalink
jsc/wasm32/wasm32.jsc: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Feb 3, 2021
1 parent f7a1fb1 commit 6feb959
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jsc/wasm32/wasm32.jsc
Original file line number Diff line number Diff line change
Expand Up @@ -5243,7 +5243,7 @@ if (typeof(os) !== "undefined" &&
let timestamp = Date.now();
if (this.pwd !== undefined)
command = "(cd " + this.pwd + "; PWD=. " + command + ")>/tmp/tmp.out." + timestamp;
command = command.replace("sh -c ", "");
command = command.replace(/\bsh -c /, "");
try {
let pid = os.spawn(command);
let o = os.waitpid(pid);
Expand Down Expand Up @@ -5516,6 +5516,13 @@ ThinThin.renameat2 = function (oldfdno, oldpathptr, newfdno, newpathptr, flags)
var oldpath = CStringAt(this.HEAPU8, oldpathptr);
var newpath = CStringAt(this.HEAPU8, newpathptr);

if (this.pwd) {
if (oldpath[0] !== "/")
oldpath = this.pwd + "/" + oldpath;
if (newpath[0] !== "/")
newpath = this.pwd + "/" + newpath;
}

os.system(`mv ${oldpath} ${newpath}`);
return Promise.resolve(0);
};
Expand Down

0 comments on commit 6feb959

Please sign in to comment.