-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(server): add shell=True to npm subprocess calls for Windows compa… #3194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ async def enable_cors(request, response): | |
|
||
async def start_vue_dev_server(): | ||
await asyncio.create_subprocess_shell( | ||
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH | ||
"npm run dev", stdout=sys.stdout, stderr=sys.stderr, cwd=MAGMA_PATH, shell=True | ||
) | ||
logging.info("VueJS development server is live.") | ||
|
||
|
@@ -256,15 +256,15 @@ def list_str(values): | |
if args.uiDevHost: | ||
if not os.path.exists(f"{MAGMA_PATH}/dist"): | ||
logging.info("Building VueJS front-end.") | ||
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) | ||
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True, shell=True) | ||
logging.info("VueJS front-end build complete.") | ||
app_svc.application.on_response_prepare.append(enable_cors) | ||
|
||
if args.build: | ||
if len(os.listdir(MAGMA_PATH)) > 0: | ||
logging.info("Building VueJS front-end.") | ||
subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True) | ||
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True) | ||
subprocess.run(["npm", "install"], cwd=MAGMA_PATH, check=True, shell=True) | ||
subprocess.run(["npm", "run", "build"], cwd=MAGMA_PATH, check=True, shell=True) | ||
Comment on lines
+259
to
+267
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback
Comment on lines
+259
to
+267
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
logging.info("VueJS front-end build complete.") | ||
else: | ||
logging.warning( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
shell=True
withasyncio.create_subprocess_shell
is redundant sincecreate_subprocess_shell
already executes commands through the shell by default. Consider usingasyncio.create_subprocess_exec
with the command split into arguments for better security and consistency with the other subprocess calls.Copilot uses AI. Check for mistakes.