8000 Add cwd to ops · postgrespro/testgres@d091eb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit d091eb1

Browse files
author
vshepard
committed
Add cwd to ops
1 parent 2512835 commit d091eb1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

testgres/operations/local_ops.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def _run_command__nt(self, cmd, shell, input, stdin, stdout, stderr, get_process
101101
process = subprocess.Popen(
102102
cmd,
103103
shell=shell,
104+
cwd=self.cwd,
104105
stdin=stdin or subprocess.PIPE if input is not None else None,
105106
stdout=stdout,
106107
stderr=stderr,
@@ -151,6 +152,7 @@ def _run_command__generic(self, cmd, shell, input, stdin, stdout, stderr, get_pr
151152
process = subprocess.Popen(
152153
cmd,
153154
shell=shell,
155+
cwd=self.cwd,
154156
stdin=stdin or subprocess.PIPE if input is not None else None,
155157
stdout=stdout or subprocess.PIPE,
156158
stderr=stderr or subprocess.PIPE,

testgres/operations/os_ops.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import getpass
22
import locale
3+
import os
34

45

56
class ConnectionParams:
@@ -18,6 +19,7 @@ def get_default_encoding():
1819

1920
class OsOperations:
2021
def __init__(self, username=None):
22+
self.cwd = os.getcwd()
2123
self.ssh_key = None
2224
self.username = username or getpass.getuser()
2325

@@ -133,3 +135,7 @@ def is_port_free(self, number: int):
133135

134136
def get_tempdir(self) -> str:
135137
raise NotImplementedError()
138+
139+
def set_cwd(self, cwd):
140+
if cwd:
141+
self.cwd = cwd

0 commit comments

Comments
 (0)
0