repro steps:
1. geany a.py
2. press F5 to run it
3. it shows a terminal with some error and asks user to press ENTER to close the terminal
4. instead press CTRL-C
Actual:
geany how aborts geany_run_script.sh execution so that the last line nevers gets run (the last line is "rm $0" because the user is never supposed to even know that geany_run_script.sh is being created, it's an implementation detail).
Expected:
geany should never leave copies of geany_run_script.sh around
Note #1: I use geany for tons of stuff.... I did a quick search in my home dir and found tens of copies littered all over, in all kinds of dirs. they are just junk, I don't want them there.
Good news is that the fix is easy, the "rm $0" command just needs to execute before the terminal window waits for the ENTER key stroke.
The following patch does exactly that:
diff -r -u geany_apt_clean/geany-0.16/src/build.c geany_apt/geany-0.16/src/build.c
--- geany_apt_clean/geany-0.16/src/build.c 2009-02-10 22:10:50.000000000 +0100
+++ geany_apt/geany-0.16/src/build.c 2009-03-24 22:41:19.000000000 +0100
@@ -944,7 +944,7 @@
#else
str = g_strdup_printf(
"#!/bin/sh\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
- \n\n%s\nrm $0\n", cmd, (autoclose) ? "" :
+ \nrm $0\n%s\n", cmd, (autoclose) ? "" :
"\necho \"Press return to continue\"\n#to be more compatible with shells like dash\ndummy_var=\"\"\nread dummy_var");
#endif
Another Ubuntu user pointed out that the program might go into an infinite loop and then geany will still leave a copy of geany_run_script.sh around. Because of this, it would be a much better solution to run the "rm $0" at the very beginning of the script, before the program is even invoked.
Here is a patch (targeting geany GIT HEAD) that fixes the bug.
Yes, thought about moving the rm call to the very beginning too when reading your report.
I'm a bit concerned about portability but tested it with dash and it seems to work, so let's hope it will be ok.
Committed in SVN r3651.
Thanks.