Skip to content

Commit 56add15

Browse files
committed
Move interactive shell invocation to a RepoSandbox method
1 parent d419981 commit 56add15

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cookie_python/manage/repo.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ def run(
6262
kwargs.setdefault("cwd", self.clone_path)
6363
return subprocess.run(*popenargs, check=check, **kwargs)
6464

65+
def shell(self) -> None:
66+
print('Run "exit 1" to abort')
67+
self.run([os.environ.get("SHELL", "/bin/bash")])
68+
6569
def commit_changes(self, message: str) -> None:
6670
self.run(["git", "add", "--", "."])
6771
self.run(
@@ -92,8 +96,7 @@ def lint_test(self) -> None:
9296
except subprocess.CalledProcessError as e:
9397
print(e)
9498
print("Resolve errors and exit shell to continue")
95-
print('Run "exit 1" to abort')
96-
self.run([os.environ.get("SHELL", "/bin/bash")])
99+
self.shell()
97100

98101
def open_pr(self, message: str) -> None:
99102
if self.dry_run:

cookie_python/manage/update.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def update_cruft(repo: RepoSandbox) -> Optional[str]:
4949
if try_count == 0:
5050
print(f">>> Conflicts found: {rej_files}")
5151
print("Resolve conflicts and exit shell to continue")
52-
print('Run "exit 1" to abort')
53-
repo.run([os.environ.get("SHELL", "/bin/bash")])
52+
repo.shell()
5453
continue
5554
raise Exception(f"Unresolved conflicts: {rej_files}")
5655

0 commit comments

Comments
 (0)