Closed GoogleCodeExporter closed 9 years ago
thanks for mentioning. I think the diff below should fix this (I'll add it to
SVN
later). note that it's still not possible to catch a SystemExit.
--- ../shedskin-0.0.26-1/lib/sys.cpp 2008-01-16 21:13:59.000000000 +0100
+++ lib/sys.cpp 2008-01-17 15:08:31.000000000 +0100
@@ -32,9 +32,13 @@
_stderr = new file(stderr);
}
-void exit(int code) {
- std::exit(code);
-};
+void exit() {
+ std::exit(0);
+};
+
+template<> void exit(int x) {
+ std::exit(x);
+}
} // module namespace
srepmub@akemi:~/shedskin$ diff -u ../shedskin-0.0.26-1/lib/sys.hpp lib/sys.hpp
--- ../shedskin-0.0.26-1/lib/sys.hpp 2008-01-16 21:13:59.000000000 +0100
+++ lib/sys.hpp 2008-01-17 15:08:12.000000000 +0100
@@ -14,7 +14,15 @@
extern str *__name__, *copyright, *platform;
extern int hexversion, maxint;
extern file *_stdin, *_stdout, *_stderr;
-void exit(int code=0);
+
+void exit();
+template<class T> void exit(T x) {
+ if(x == 0)
+ std::exit(0);
+ print(_stderr, "%s\n", __str(x));
+ std::exit(1);
+}
+template<> void exit(int x);
} // module namespace
#endif
Original comment by mark.duf...@gmail.com
on 17 Jan 2008 at 2:18
Original comment by mark.duf...@gmail.com
on 17 Jan 2008 at 2:20
marking this as fixed.
Original comment by mark.duf...@gmail.com
on 22 Jan 2008 at 8:02
With python one can sys.exit(1) without anything being printed on
stdout/stderr. How can one achieve this with shedskin? I miss a way to exit(1)
without anything printing.
Original comment by rods...@gmail.com
on 3 Jan 2012 at 10:53
thanks for mentioning. this looks like a regression. I'm adding some tests for
this now, and will hopefully fix the problem shortly..
Original comment by mark.duf...@gmail.com
on 4 Jan 2012 at 7:51
alright, fixed in GIT:
http://gitorious.org/shedskin/mainline/commit/b07c86912155e1d651c360ab6a859d1b4e
8db5e2
thanks again for mentioning! :-)
Original comment by mark.duf...@gmail.com
on 4 Jan 2012 at 8:37
Original issue reported on code.google.com by
rune.str...@gmail.com
on 16 Jan 2008 at 1:31