Skip to content

Commit

Permalink
make forkexec work properly when . in PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Nov 6, 2022
1 parent 7f31521 commit e604abc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/kernel/src/wasm/posix/fork-exec.ts
Expand Up @@ -26,7 +26,7 @@ extern int python_wasm_fork_exec(
import debug from "debug";
import { nativeToWasm } from "./errno";
import constants from "./constants";
import { join } from "path";
import { join, resolve } from "path";

const log = debug("posix:fork-exec");

Expand Down Expand Up @@ -235,7 +235,7 @@ export default function fork_exec({
// search path
log("cowasm_vforkexec", "go through search path to find", argv[0]);
for (const dir of path.split(":")) {
const pathToCmd = join(dir, argv[0]);
const pathToCmd = join(resolve(dir), argv[0]);
try {
const stat = fs.statSync(pathToCmd);
if (stat.mode & fs.constants.S_IXUSR) {
Expand Down
25 changes: 25 additions & 0 deletions packages/py-ipython/Makefile
@@ -0,0 +1,25 @@
include ../build/Makefile-vars

all: wasm

# See https://pypi.org/project/ipython/#files
# Note that with PYPI (unlike github) you have to copy the entire URL to the source
# every single time. Updating the version is not sufficient.
VERSION = 8.6.0
URL = https://files.pythonhosted.org/packages/7f/59/05e94e067afb61460f0d5229a1edb800e2f65b8436085fad9cd262d80d45/ipython-8.6.0.tar.gz
TARBALL = ${UPSTREAM}/ipython-${VERSION}.tar.gz

include ../build/Makefile-rules

${BUILD_WASM}/.built: ${BUILD_WASM}/.build
touch ${BUILD_WASM}/.built

test: ${BUILD_WASM}/.built
cd ${BUILD_WASM}/build/lib \
&& PYTHONPATH=`pwd` python-wasm mpmath/tests/runtests.py

${DIST_WASM}/.built: ${BUILD_WASM}/.built
cd ${BUILD_WASM} \
&& ${BIN}/python-wasm setup.py build
touch ${DIST_WASM}/.built

0 comments on commit e604abc

Please sign in to comment.