added shell attribute to unit object definition to allow more flexibility; defaults to sh

master
Master 2020-07-01 22:57:32 -04:00
parent c4828d506b
commit 3b467e2c0a
3 changed files with 11 additions and 15 deletions

View File

@ -95,15 +95,10 @@ int Sproc::execute( std::string shell, std::string environment_file, std::string
return -401; return -401;
} }
std::string sourcer_string = shell + " -c '. " + environment_file + "'"; std::string sourcer = shell + " -c \". " + environment_file + " && " + command + "\"";
slog.log( E_DEBUG, "Shell call for loading: ``" + sourcer_string + "``." ); slog.log( E_DEBUG, "Shell call for loading: ``" + sourcer + "``." );
int sourcer = system( sourcer_string.c_str() ); std::cerr << sourcer.c_str() << std::endl;
if ( sourcer != 0) exit_code_raw = system( sourcer.c_str() );
{
slog.log(E_FATAL, "Failed to source environment file.");
return -127;
}
exit_code_raw = system( command.c_str() );
exit( WEXITSTATUS( exit_code_raw ) ); exit( WEXITSTATUS( exit_code_raw ) );
} else if ( pid > 0 ) } else if ( pid > 0 )
{ {

View File

@ -1,9 +1,6 @@
whoami #!/bin/bash
id
touch /home/bagira/testfile echo "Test var is: $TEST_VAR"
stat /home/bagira/testfile
#dialog --stdout --title "Interact with me!" \ #dialog --stdout --title "Interact with me!" \
# --backtitle "This is user interaction." \ # --backtitle "This is user interaction." \

View File

@ -1 +1,5 @@
echo "This is output from loading the variables file." set -a
echo "This is output from loading the variables file."
TEST_VAR="999"