interpolate issue resolved

This commit is contained in:
phanes committed 2024-02-10 16:44:21 -05:00
1 parent 54d95aa582
commit 879f07ec4b
7 files changed
+36 -14

No files matched your search

-5
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
+1 -1
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
+14 -2
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 ) )
{