0

AppVeyor provides build worker images for windows, linux and macos to run unit tests.

So we can use the same appveyor.yml to control builds running on both these OS.

We can distinguish between windows and linux platforms by using few possibilities, as variables ($isLinux, $isWindows, APPVEYOR_YML_DISABLE_PS_LINUX) or prefix commands ( sh:, cmd:).

What can we use to distinguish beetween linux and macos ?

I need a solution in command line. I had thought of solution as using python -c "import platform; platform.system()", but how can I get the result in this case ?

servoz
  • 606
  • 9
  • 22
  • Does this answer your question? [Python: What OS am I running on?](https://stackoverflow.com/questions/1854/python-what-os-am-i-running-on) – Felipe Whitaker Sep 25 '21 at 13:15

2 Answers2

2

In Bash:

platform=$(uname -s)
if [[ $platform == Darwin ]]; then
    echo "it's macOS"
elif [[ $platform == Linux ]]; then
    echo "it's Linux"
else
Feodor Fitsner
  • 2,354
  • 16
  • 13
0

From Python: What OS am I running on?

>>> import platform
>>> platform.system()
'Windows' # for Linux it prints 'Linux', Mac it prints `'Darwin'
Felipe Whitaker
  • 470
  • 3
  • 9
  • 1
    I need to a solution in command Line. I had thought of this type of solution using python -c "import platform; platform.system()", But how can I get the result in this case ? – servoz Sep 25 '21 at 14:26