Welcome to the Linux Foundation Forum!

CH.15 Lab.1 - spawn Unknown system error -8

First I ran into EACCES error and had to add execute permissions to the files in the folder. Now I'm wondering if this is a similar permission error the spawn throws when trying to spawn the process.

index.js

function exercise (myEnvVar) {
  const process = spawn(child_path, [], { env: { MY_ENV_VAR: myEnvVar } })

  return process
}

test.js

sp = exercise(value)
sp.on('error', (err) => { throw err })

Error

  if (status == null) throw err
                      ^

Error: spawn Unknown system error -8
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at exercise (/Users/karlonauger/code/my-package/labs/ch-15/labs-1/index.js:22:19)
    at Object.<anonymous> (/Users/karlonauger/code/my-package/labs/ch-15/labs-1/test.js:12:8)

Answers

  • Perhaps -8 means ENOEXEC (Executable file format error). I wonder what value does child_path hold.

Categories

Upcoming Training