Skip to content
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

Set default ComSpec when running on Windows #1595

Merged
merged 3 commits into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion flytekit/extras/tasks/shell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import os
import platform
import string
import subprocess
import typing
Expand Down Expand Up @@ -213,6 +214,9 @@ def execute(self, **kwargs) -> typing.Any:
print("\n==============================================\n")

try:
if platform.system() == "Windows" and os.environ.get("ComSpec") is None:
# https://github.com/python/cpython/issues/101283
os.environ["ComSpec"] = "C:\\Windows\\System32\\cmd.exe"
subprocess.check_call(gen_script, shell=True)
except subprocess.CalledProcessError as e:
files = os.listdir(".")
Expand Down Expand Up @@ -356,7 +360,6 @@ def execute(self, **kwargs) -> typing.Any:
# This utility function allows for the specification of env variables, arguments, and the actual script within the
# workflow definition rather than at `RawShellTask` instantiation
def get_raw_shell_task(name: str) -> RawShellTask:

return RawShellTask(
name=name,
debug=True,
Expand Down