Skip to content

Commit

Permalink
Stop relying on Bash being located at /bin/bash (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
hodlinator authored Sep 11, 2024
1 parent a1dd945 commit c1d76ef
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resources/images/bitcoin/insecure/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

if [ "$(echo "$1" | cut -c1)" = "-" ]; then
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/connect_logging.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# NO `set -e` here so an error does not exit the script

POD_NAME=$(kubectl get pods --namespace warnet-logging -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=loki-grafana" -o jsonpath="{.items[0].metadata.name}")
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/setup_user_contexts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Function to check if a command exists
command_exists() {
Expand Down
2 changes: 1 addition & 1 deletion src/warnet/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get_messages(tank_a: str, tank_b: str, chain: str):
import subprocess

blob = subprocess.run(
cmd, shell=True, capture_output=True, executable="/bin/bash"
cmd, shell=True, capture_output=True, executable="bash"
).stdout

# Parse the blob
Expand Down
6 changes: 2 additions & 4 deletions src/warnet/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@


def run_command(command: str) -> str:
result = subprocess.run(
command, shell=True, capture_output=True, text=True, executable="/bin/bash"
)
result = subprocess.run(command, shell=True, capture_output=True, text=True, executable="bash")
if result.returncode != 0:
raise Exception(result.stderr)
return result.stdout


def stream_command(command: str) -> bool:
process = subprocess.Popen(
["/bin/bash", "-c", command],
["bash", "-c", command],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
Expand Down

0 comments on commit c1d76ef

Please sign in to comment.