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

Doesn't work with async child_process functions in Nodejs #23

Open
neurocmd opened this issue Aug 16, 2023 · 0 comments
Open

Doesn't work with async child_process functions in Nodejs #23

neurocmd opened this issue Aug 16, 2023 · 0 comments

Comments

@neurocmd
Copy link

neurocmd commented Aug 16, 2023

I'm trying to run glyphhanger console command with child_process exec function and it hangs and the process never ends. But with execSync it works

This works

execSync(
  `npx glyphhanger --subset=*.ttf --formats=woff2,woff --output=.`
)

But this doesn't

exec(`npx glyphhanger --subset=*.ttf --formats=woff2,woff --output=.`, (error, stdout, stderr) => {
  if (error) {
    console.error(`Error: ${error.message}`)
    return
  }
  if (stderr) {
    console.error(`stderr: ${stderr}`)
    return
  }
  console.log(`stdout:\n${stdout}`)
})

Had to resort to spawn with these options

{
  shell: true,
  stdio: 'inherit'
}

Maybe it has something to do with Python libraries?

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