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

View File

@ -1,9 +1,6 @@
whoami
id
#!/bin/bash
touch /home/bagira/testfile
stat /home/bagira/testfile
echo "Test var is: $TEST_VAR"
#dialog --stdout --title "Interact with me!" \
# --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"