Skip to content

Commit d39a1aa

Browse files
committed
execvpe => execve (no $PATH needed)
1 parent 353a0a6 commit d39a1aa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gunicorn/arbiter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def reexec(self):
437437
os.chdir(self.START_CTX['cwd'])
438438

439439
# exec the process using the original environment
440-
os.execvpe(self.START_CTX[0], self.START_CTX['args'], environ)
440+
os.execve(self.START_CTX[0], self.START_CTX['args'], environ)
441441

442442
def reload(self):
443443
old_address = self.cfg.address

tests/test_arbiter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,24 @@ def test_arbiter_stop_does_not_unlink_when_using_reuse_port(close_sockets):
7171

7272
@mock.patch('os.getpid')
7373
@mock.patch('os.fork')
74-
@mock.patch('os.execvpe')
75-
def test_arbiter_reexec_passing_systemd_sockets(execvpe, fork, getpid):
74+
@mock.patch('os.execve')
75+
def test_arbiter_reexec_passing_systemd_sockets(execve, fork, getpid):
7676
arbiter = gunicorn.arbiter.Arbiter(DummyApplication())
7777
arbiter.LISTENERS = [mock.Mock(), mock.Mock()]
7878
arbiter.systemd = True
7979
fork.return_value = 0
8080
getpid.side_effect = [2, 3]
8181
arbiter.reexec()
82-
environ = execvpe.call_args[0][2]
82+
environ = execve.call_args[0][2]
8383
assert environ['GUNICORN_PID'] == '2'
8484
assert environ['LISTEN_FDS'] == '2'
8585
assert environ['LISTEN_PID'] == '3'
8686

8787

8888
@mock.patch('os.getpid')
8989
@mock.patch('os.fork')
90-
@mock.patch('os.execvpe')
91-
def test_arbiter_reexec_passing_gunicorn_sockets(execvpe, fork, getpid):
90+
@mock.patch('os.execve')
91+
def test_arbiter_reexec_passing_gunicorn_sockets(execve, fork, getpid):
9292
arbiter = gunicorn.arbiter.Arbiter(DummyApplication())
9393
listener1 = mock.Mock()
9494
listener2 = mock.Mock()
@@ -98,7 +98,7 @@ def test_arbiter_reexec_passing_gunicorn_sockets(execvpe, fork, getpid):
9898
fork.return_value = 0
9999
getpid.side_effect = [2, 3]
100100
arbiter.reexec()
101-
environ = execvpe.call_args[0][2]
101+
environ = execve.call_args[0][2]
102102
assert environ['GUNICORN_FD'] == '4,5'
103103
assert environ['GUNICORN_PID'] == '2'
104104

0 commit comments

Comments
 (0)