Skip to content

Commit 310372e

Browse files
fix: add shell for windows os
1 parent 28732d4 commit 310372e

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

gitmen/commands/projects_update.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import os
22
import subprocess
3+
import platform
34
import i18n
45
import re
56
from rich.console import Console
67
from rich.rule import Rule
78
from ..utils import deps_logs, logger_expection
89

910
console = Console()
11+
windowsOS = platform.system() == "Windows"
1012

1113

1214
# Função para atualizar dependências de um projeto
@@ -34,6 +36,7 @@ def projects_update(projects, ignored_deps, commit_message, base_dir):
3436
["npm", "outdated", "--parseable", "--depth=0"],
3537
capture_output=True,
3638
text=True,
39+
shell=windowsOS
3740
)
3841

3942
# Exibir a saída completa para depuração
@@ -61,7 +64,7 @@ def projects_update(projects, ignored_deps, commit_message, base_dir):
6164
ignored_array = [dep.strip() for dep in ignored_deps.split(",")]
6265
pattern = r"@\d+\.\d+\.\d+$"
6366
for package in outdated_packages.split("\n"):
64-
package_name = package.split(":")[3]
67+
package_name = package.split(":")[2]
6568
package_name_clean = re.sub(pattern, "", package_name)
6669
if not any(
6770
package_name_clean.strip() == ignored_dep
@@ -73,7 +76,7 @@ def projects_update(projects, ignored_deps, commit_message, base_dir):
7376
deps_logs(deps_up=packages_names, deps_off=ignored_array)
7477
else:
7578
for package in outdated_packages.split("\n"):
76-
package_name = package.split(":")[3]
79+
package_name = package.split(":")[2]
7780
packages_names.append(package_name.strip())
7881

7982
if outdated_packages:
@@ -125,15 +128,15 @@ def update_and_commit(packages_names, commit_message):
125128

126129
# Atualiza todos os pacotes desatualizados de uma vez
127130
subprocess.run(
128-
["npm", "install"] + packages_names + ["--legacy-peer-deps"], check=True
131+
["npm", "install"] + packages_names + ["--legacy-peer-deps"], check=True, shell=windowsOS
129132
)
130133
console.print(Rule(style="grey11"))
131134

132135
# Adiciona mudanças ao Git, cria um commit e faz push
133-
subprocess.run(["git", "status"], check=True)
134-
subprocess.run(["git", "add", "package.json", "package-lock.json"], check=True)
135-
subprocess.run(["git", "commit", "-m", commit_message], check=True)
136-
subprocess.run(["git", "push"], check=True)
136+
subprocess.run(["git", "status"], check=True, shell=windowsOS)
137+
subprocess.run(["git", "add", "package.json", "package-lock.json"], check=True, shell=windowsOS)
138+
subprocess.run(["git", "commit", "-m", commit_message], check=True, shell=windowsOS)
139+
subprocess.run(["git", "push"], check=True, shell=windowsOS)
137140
console.print(Rule(style="grey11"))
138141

139142
console.print(

gitmen/commands/script.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import os
22
import subprocess
3+
import platform
34
import i18n
45
from rich.console import Console
56
from rich.rule import Rule
67
from ..codeArt import gitmenArt
78

89
console = Console()
9-
10+
windowsOS = platform.system() == "Windows"
1011

1112
# Função para instalar dependências em todos os projetos
1213
def script(base_dir, script_run):
@@ -24,7 +25,7 @@ def script(base_dir, script_run):
2425
command = script_run.split()
2526

2627
result = subprocess.run(
27-
command, stdout=subprocess.PIPE, text=True
28+
command, stdout=subprocess.PIPE, text=True, shell=windowsOS
2829
)
2930

3031
console.print(result.stdout)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="gitmen",
8-
version="0.4.2",
8+
version="0.4.3",
99
description="CLI tool for managing GitHub projects, updating dependencies, and checking project statuses.",
1010
long_description=long_description,
1111
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)