forked from nat/natalieee.net
switch to using shell builtins for thought rendering
This commit is contained in:
11
www/src/scripts/builtins/execute-bash/execute_bash.py
Normal file
11
www/src/scripts/builtins/execute-bash/execute_bash.py
Normal file
@ -0,0 +1,11 @@
|
||||
def _execute_bash(*args):
|
||||
from re import sub
|
||||
from os import environ as hy_env
|
||||
from subprocess import check_output
|
||||
env = hy_env
|
||||
env['PATH'] = hy_env['PATH'] + ':./scripts'
|
||||
path = args[0]
|
||||
with open(path, 'r') as fp:
|
||||
_hy_anon_var_1 = fp.read()
|
||||
print(sub('\\$\\[(.*?)\\]', lambda sequence: check_output(sequence.group(1), shell=True, executable='/bin/bash', env=env).decode().strip(), _hy_anon_var_1))
|
||||
return 0
|
Reference in New Issue
Block a user