run a program with run-script, so terminal will not close immediately after execution

This commit is contained in:
gazer 2016-02-03 12:50:31 +03:00
parent efce30b76e
commit f8fe92aa77
1 changed files with 16 additions and 4 deletions

View File

@ -75,10 +75,22 @@ class ProgramExecutionNoDebug : Thread, ProgramExecution {
// external console support // external console support
if (!_terminalExecutable.empty) { if (!_terminalExecutable.empty) {
string cmdline = escapeShellCommand(params); string cmdline = escapeShellCommand(params);
params.length = 0; string shellScript = `
params ~= _terminalExecutable; rm $0
params ~= "-e"; ` ~ cmdline ~ `
params ~= cmdline; exit_code=$?
echo "
-----------------------
(program returned exit code: $exit_code)"
echo "Press any key to continue..."
dummy_var=""
read dummy_var
exit $exit_code
`;
std.file.write(std.path.buildPath(_executableWorkingDir, "dlangide_run_script.sh"), shellScript);
string setExecFlagCommand = escapeShellCommand("chmod", "+x", "dlangide_run_script.sh");
spawnShell(setExecFlagCommand, stdin, stdout, stderr, null, Config.none, _executableWorkingDir);
params = [_terminalExecutable, "-e", "./dlangide_run_script.sh"];
} }
File newstdin; File newstdin;