sshpeer: update bash script detection

Summary:
Now `#!/usr/bin/env bash` is used for bash scripts (by D47269779) we need to
update the bash detection for test compatibility.

Reviewed By: evangrayk

Differential Revision: D47457479

fbshipit-source-id: c6a449f53fb265f8a01d6368fe807e0b8bae03aa
This commit is contained in:
Jun Wu 2023-07-14 09:56:10 -07:00 committed by Facebook GitHub Bot
parent 200ff484a7
commit ec426ff2fe

View File

@ -353,8 +353,12 @@ def _popen4testhgserve(path, env=None, newlines: bool = False, bufsize: int = -1
return True
with open(file, "rb") as file:
start = file.read(12)
return (b"#!/bin/bash" in start) or (b"#!/bin/sh" in start)
start = file.read(32)
return (
(b"#!/bin/bash" in start)
or (b"#!/bin/sh" in start)
or b"env bash" in start
)
return False
# Append "defpath" (ex. /bin) to PATH. Needed for buck test (the main hg