stripe-node icon indicating copy to clipboard operation
stripe-node copied to clipboard

Deprecate use of `child_process` for bun compatibility

Open paulasjes-stripe opened this issue 3 years ago • 0 comments
trafficstars

Is your feature request related to a problem? Please describe.

stripe-node currently uses the exec function of the child_process library to gather usage telemetry. It does this by running uname -a in a shell.

Newcomer runtime bun doesn't have child_process implemented yet, preventing stripe-node from being able to be used.

Instead of using exec, we could just use the os core library to get the OS version:

require('os').version();

Here's a comparison of the two:

> os.version()
'Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000'

❯ uname -a
Darwin paul 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64

os is available in bun plus probably safer than having a function that can execute instructions on the command line.

Describe the solution you'd like

Deprecate usage of child_process in favour of os. Or remove the collection of OS version data entirely if we don't need it.

Describe alternatives you've considered

Wait for bun to implement child_process.

paulasjes-stripe avatar Aug 16 '22 14:08 paulasjes-stripe