Proper way the execute shell commands for different platforms


#1

Hello,
I need to run some shell commands (via child_process), but the build will be on Windows and Unix envs.
whats the best way to do this ? (since cmd is diferent than bash) should i detect the platform and change commands, or is there a way to run bash in windows ? (powershell)


#2

You should detect which platform you’re working with and have different shell commands for each. It is possible to use bash on Windows, but not everyone wants it or knows about it.