VS Code terminal runs Python code as different user

  Kiến thức lập trình

When running this file with python test.py:

import os
import getpass

print(f"Env thinks the user is {os.getlogin()}")
print(f"Effective user is {getpass.getuser()}")

in my VS Code terminal I get:

Env thinks the user is root
Effective user is johndoe

but running it in a normal macOS terminal gives

Env thinks the user is johndoe
Effective user is johndoe

Does anyone know why there is a difference? Unfortunately this causes a permission errors when not using my user. Is it a setting in VS Code is misconfigured etc.?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT