Closed flamendless closed 3 years ago
previously im doing this to launch a C++ bin in a separate terminal in linux:
std::string cmd_linux = fmt::format("$TERMINAL -e \"./{:s}\"", filename); FILE* p = popen(cmd_linux.c_str(), "r"); if (p == NULL) return RES_FAIL; pclose(p);
but converting it to using subprocess works in that it doesnt throw any error, but there's nothing ran.
const char* cmd_linux[] = {filename.c_str(), NULL}; //const char* cmd_linux[] = {"$TERMINAL", "-e", filename.c_str(), NULL}; //doesnt even work struct subprocess_s subprocess; int result = subprocess_create(cmd_linux, subprocess_option_inherit_environment, &subprocess); if (result != 0) return RES_FAIL;
the file to be ran is in the same directory as the program. The program to run has a getchar() at then end so it wont close automatically
getchar()
I'm pretty sure that my thing won't know what $TERMINAL is to run it.
$TERMINAL
previously im doing this to launch a C++ bin in a separate terminal in linux:
but converting it to using subprocess works in that it doesnt throw any error, but there's nothing ran.
the file to be ran is in the same directory as the program. The program to run has a
getchar()
at then end so it wont close automatically