Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] posix_spawnp failed after calling spawn multiple times #670

Open
fadezak100 opened this issue Mar 6, 2024 · 0 comments
Open

[bug] posix_spawnp failed after calling spawn multiple times #670

fadezak100 opened this issue Mar 6, 2024 · 0 comments

Comments

@fadezak100
Copy link

Environment details

  • OS: macOs
  • OS version: 12.0
  • node-pty version: 1.0.0

Issue description

I randomly get this error when calling spawn function multiple consecutive times:

/node_modules/node-pty/src/unixTerminal.ts:114
    const term = pty.fork(file, args, parsedEnv, cwd, this._cols, this._rows, uid, gid, (encoding === 'utf8'), helperPath, onexit);
                     ^
Error: posix_spawnp failed.

Here's a script to reproduce the problem.

import { spawn } from "node-pty"

const reproduce = async () => {
    for(let i = 0; i <= 1000; i++) {
        console.log(`the error is in ${i} iteration`)
        await spawn(`echo hello ${i}`, [], {
            name: 'xterm-color',
            cols: 80,
            rows: 30,
            cwd: process.env.HOME,
            env: process.env as any,
        })
    }
}

try {
    reproduce()
} catch (error) {
    console.error(error)
}
@fadezak100 fadezak100 changed the title posix_spawnp failed after calling spawn multiple times [bug] posix_spawnp failed after calling spawn multiple times Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant