fix -- not working correctly
This commit is contained in:
parent
e2e2300337
commit
472fd5306c
3 changed files with 12 additions and 5 deletions
2
Makefile
2
Makefile
|
|
@ -14,7 +14,7 @@ LDFLAGS = -lpthread
|
||||||
# compiler
|
# compiler
|
||||||
CC=g++
|
CC=g++
|
||||||
# compiler flags
|
# compiler flags
|
||||||
CXXFLAGS= -I$(IDIR) -Wall -pedantic -std=c++17
|
CXXFLAGS= -I$(IDIR) -Wall -pedantic -std=c++20
|
||||||
ifeq ($(DEBUG),true)
|
ifeq ($(DEBUG),true)
|
||||||
# debugging flags
|
# debugging flags
|
||||||
CC=clang++
|
CC=clang++
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ void parse_exec(FILE* fd, const char* in, uint32_t size, std::string const& file
|
||||||
}
|
}
|
||||||
catch(ztd::format_error& e)
|
catch(ztd::format_error& e)
|
||||||
{
|
{
|
||||||
throw ztd::format_error(e.what(), e.where(), in, filename);
|
throw ztd::format_error(e.what(), filename, in, e.where());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +255,7 @@ int exec_process(std::string const& runtime, std::vector<std::string> const& arg
|
||||||
pid_t pid=0;
|
pid_t pid=0;
|
||||||
// std::string test="echo Hello world\nexit 10\n";
|
// std::string test="echo Hello world\nexit 10\n";
|
||||||
// fprintf(ffd, "%s\n",, test.c_str(), test.size());
|
// fprintf(ffd, "%s\n",, test.c_str(), test.size());
|
||||||
FILE* ffd;
|
FILE* ffd=0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pid = forkexec(runargs[0], runargs.data());
|
pid = forkexec(runargs[0], runargs.data());
|
||||||
|
|
|
||||||
11
src/main.cpp
11
src/main.cpp
|
|
@ -54,9 +54,16 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
||||||
|
bool optstop=false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
args=options.process(argc, argv, false, true);
|
args=options.process(argc, argv, {.stop_on_argument=true, .output_doubledash=true} );
|
||||||
|
if( args[0] == "--" )
|
||||||
|
{
|
||||||
|
optstop=true;
|
||||||
|
args.erase(args.begin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +133,7 @@ int main(int argc, char* argv[])
|
||||||
else
|
else
|
||||||
is_exec = shebang_is_bin;
|
is_exec = shebang_is_bin;
|
||||||
|
|
||||||
if(!is_exec && args.size() > 1) // not exec: parse options on args
|
if(!is_exec && args.size() > 1 && !optstop) // not exec: parse options on args
|
||||||
args=options.process(args);
|
args=options.process(args);
|
||||||
|
|
||||||
if(!is_exec && options['e'])
|
if(!is_exec && options['e'])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue