Skip to content

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

@neurocmd

Description

@neurocmd

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions