Skip to content

Commit

Permalink
Add passing bash version to read_vars_file (#729)
Browse files Browse the repository at this point in the history
* Add passing bash version to read_vars_file

Signed-off-by: Bolun Thompson <[email protected]>

* Add reading bash version in pa.sh, not in python

Signed-off-by: Bolun Thompson <[email protected]>

---------

Signed-off-by: Bolun Thompson <[email protected]>
  • Loading branch information
BolunThompson authored Nov 18, 2024
1 parent 57747d3 commit d5a3b13
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions compiler/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

SOCKET_BUF_SIZE = 8192

BASH_VERSION = tuple(int(i) for i in os.getenv("PASH_BASH_VERSION").split(" "))


##
## Global configuration used by all pash components
Expand Down
2 changes: 1 addition & 1 deletion compiler/pash_compilation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def compile_and_add(self, compiled_script_file, var_file, input_ir_file):

variable_reading_start_time = datetime.now()
# Read any shell variables files if present
vars_dict = env_vars_util.read_vars_file(var_file)
vars_dict = env_vars_util.read_vars_file(var_file, config.BASH_VERSION)
config.set_vars_file(var_file, vars_dict)

variable_reading_end_time = datetime.now()
Expand Down
2 changes: 1 addition & 1 deletion compiler/pash_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def main_body():
runtime_config = config.config["distr_planner"]

## Read any shell variables files if present
vars_dict = env_vars_util.read_vars_file(args.var_file)
vars_dict = env_vars_util.read_vars_file(args.var_file, config.BASH_VERSION)
config.set_vars_file(args.var_file, vars_dict)

log("Input:", args.input_ir, "Compiled file:", args.compiled_script_file)
Expand Down
3 changes: 3 additions & 0 deletions pa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ then
exit
fi

## get bash version for pash
export PASH_BASH_VERSION="${BASH_VERSINFO[@]:0:3}"

## Create a temporary directory where PaSh can use for temporary files and logs
export PASH_TMP_PREFIX="$(mktemp -d /tmp/pash_XXXXXXX)/"

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ graphviz
libdash
pash-annotations==0.2.2
shasta==0.1.0
sh-expand>=0.1.3
sh-expand>=0.1.6

0 comments on commit d5a3b13

Please sign in to comment.