interpolate issue resolved

master
phanes 2024-02-10 16:44:21 -05:00
parent 54d95aa582
commit 879f07ec4b
7 changed files with 36 additions and 14 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/bash
#
echo test from script
/usr/bin/dialog --title "This should be one argument" --inputbox "Enter your name:" 0 0
#/usr/bin/dialog --title "This should be one argument" --inputbox "Enter your name:" 0 0

View File

@ -1,9 +1,5 @@
#!/usr/bin/bash
set -a
echo "variables file says hello and set a variable named TEST_VAR"

View File

@ -1,5 +1,6 @@
{
"plan": [
{ "name": "independent test 1", "dependencies": [ null ] }
{ "name": "independent test 1", "dependencies": [ null ] },
{ "name": "independent test 2", "dependencies": [ null ] }
]
}

View File

@ -17,6 +17,24 @@
"group": "$USER",
"supply_environment": true,
"environment": "environments/rex.variables"
},
{
"name": "independent test 2",
"target": "components/independent_test_1.bash --ls -s --arg",
"is_shell_command": true,
"shell_definition": "bash",
"force_pty": true,
"set_working_directory": false,
"working_directory": "",
"rectify": false,
"rectifier": "echo rectifier executed",
"active": true,
"required": true,
"set_user_context": true,
"user": "$USER",
"group": "$USER",
"supply_environment": true,
"environment": "environments/rex.variables"
}
]
}

View File

@ -321,11 +321,6 @@ int execute(
close(watched_fds[this_fd].fd);
break_out = true;
}
// if (watched_fds[this_fd].revents & POLLHUP) {
// // this pipe has hung up
// close(watched_fds[this_fd].fd);
// break_out = true;
// }
if (watched_fds[this_fd].revents & POLLHUP) {
// this pipe has hung up
// don't close the file descriptor yet, there might still be data to read

View File

@ -108,7 +108,7 @@ int exec_pty(
// before we fork the process, so that the child process will inherit the environment
// from the parent process
if ( environment_supplied ) {
clearenv();
//clearenv();
}
// turn our command string into something execvp can consume

View File

@ -101,10 +101,22 @@ std::string get_8601()
*
* @param text The input text to be processed
*/
//void interpolate( std::string & text )
//{
// static std::regex env1( "\\$\\{([^}]+)\\}" );
// static std::regex env2( "\\$([^/]+)" ); // matches $VAR_NAME until a / is found
// std::smatch match;
// while ( std::regex_search( text, match, env1 ) || std::regex_search( text, match, env2 ) )
// {
// const char * s = getenv( match[1].str().c_str() );
// const std::string var( s == NULL ? "" : s );
// text.replace( match[0].first, match[0].second, var );
// }
//}
void interpolate( std::string & text )
{
static std::regex env1( "\\$\\{([^}]+)\\}" );
static std::regex env2( "\\$([^/]+)" ); // matches $VAR_NAME until a / is found
std::regex env1( "\\$\\{([^}]+)\\}" );
std::regex env2( "\\$([^/]+)" ); // matches $VAR_NAME until a / is found
std::smatch match;
while ( std::regex_search( text, match, env1 ) || std::regex_search( text, match, env2 ) )
{