Fossil SCM
Added --no-print-result flag to test-th-source to suppress output of final result, as the default behavior sometimes causes duplicate output of the last expression.
Commit
817c6434350795c61d4d3fe935130a4f2b63ed39b0658fb1677b7a0058f8817a
Parent
5aa71f59b709ae0…
1 file changed
+8
-2
+8
-2
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -2932,19 +2932,22 @@ | ||
| 2932 | 2932 | ** --http Include an HTTP response header in the output |
| 2933 | 2933 | ** --open-config Open the configuration database |
| 2934 | 2934 | ** --set-anon-caps Set anonymous login capabilities |
| 2935 | 2935 | ** --set-user-caps Set user login capabilities |
| 2936 | 2936 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2937 | +** --no-print-result Do not output the final result. Use if it | |
| 2938 | +** interferes with script output. | |
| 2937 | 2939 | */ |
| 2938 | 2940 | void test_th_source(void){ |
| 2939 | 2941 | int rc; |
| 2940 | 2942 | const char *zRc; |
| 2941 | - int forceCgi, fullHttpReply; | |
| 2943 | + int forceCgi, fullHttpReply, fNoPrintRc; | |
| 2942 | 2944 | Blob in; |
| 2943 | 2945 | Th_InitTraceLog(); |
| 2944 | 2946 | forceCgi = find_option("cgi", 0, 0)!=0; |
| 2945 | 2947 | fullHttpReply = find_option("http", 0, 0)!=0; |
| 2948 | + fNoPrintRc = find_option("no-print-result",0,0)!=0; | |
| 2946 | 2949 | if( fullHttpReply ) forceCgi = 1; |
| 2947 | 2950 | if( forceCgi ) Th_ForceCgi(fullHttpReply); |
| 2948 | 2951 | if( find_option("open-config", 0, 0)!=0 ){ |
| 2949 | 2952 | Th_OpenConfig(1); |
| 2950 | 2953 | } |
| @@ -2965,11 +2968,14 @@ | ||
| 2965 | 2968 | blob_zero(&in); |
| 2966 | 2969 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 2967 | 2970 | Th_FossilInit(TH_INIT_DEFAULT); |
| 2968 | 2971 | rc = Th_Eval(g.interp, 0, blob_str(&in), -1); |
| 2969 | 2972 | zRc = Th_ReturnCodeName(rc, 1); |
| 2970 | - fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); | |
| 2973 | + if(0==fNoPrintRc){ | |
| 2974 | + fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", | |
| 2975 | + Th_GetResult(g.interp, 0)); | |
| 2976 | + } | |
| 2971 | 2977 | Th_PrintTraceLog(); |
| 2972 | 2978 | if( forceCgi ) cgi_reply(); |
| 2973 | 2979 | } |
| 2974 | 2980 | |
| 2975 | 2981 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 2976 | 2982 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -2932,19 +2932,22 @@ | |
| 2932 | ** --http Include an HTTP response header in the output |
| 2933 | ** --open-config Open the configuration database |
| 2934 | ** --set-anon-caps Set anonymous login capabilities |
| 2935 | ** --set-user-caps Set user login capabilities |
| 2936 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2937 | */ |
| 2938 | void test_th_source(void){ |
| 2939 | int rc; |
| 2940 | const char *zRc; |
| 2941 | int forceCgi, fullHttpReply; |
| 2942 | Blob in; |
| 2943 | Th_InitTraceLog(); |
| 2944 | forceCgi = find_option("cgi", 0, 0)!=0; |
| 2945 | fullHttpReply = find_option("http", 0, 0)!=0; |
| 2946 | if( fullHttpReply ) forceCgi = 1; |
| 2947 | if( forceCgi ) Th_ForceCgi(fullHttpReply); |
| 2948 | if( find_option("open-config", 0, 0)!=0 ){ |
| 2949 | Th_OpenConfig(1); |
| 2950 | } |
| @@ -2965,11 +2968,14 @@ | |
| 2965 | blob_zero(&in); |
| 2966 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 2967 | Th_FossilInit(TH_INIT_DEFAULT); |
| 2968 | rc = Th_Eval(g.interp, 0, blob_str(&in), -1); |
| 2969 | zRc = Th_ReturnCodeName(rc, 1); |
| 2970 | fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); |
| 2971 | Th_PrintTraceLog(); |
| 2972 | if( forceCgi ) cgi_reply(); |
| 2973 | } |
| 2974 | |
| 2975 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 2976 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -2932,19 +2932,22 @@ | |
| 2932 | ** --http Include an HTTP response header in the output |
| 2933 | ** --open-config Open the configuration database |
| 2934 | ** --set-anon-caps Set anonymous login capabilities |
| 2935 | ** --set-user-caps Set user login capabilities |
| 2936 | ** --th-trace Trace TH1 execution (for debugging purposes) |
| 2937 | ** --no-print-result Do not output the final result. Use if it |
| 2938 | ** interferes with script output. |
| 2939 | */ |
| 2940 | void test_th_source(void){ |
| 2941 | int rc; |
| 2942 | const char *zRc; |
| 2943 | int forceCgi, fullHttpReply, fNoPrintRc; |
| 2944 | Blob in; |
| 2945 | Th_InitTraceLog(); |
| 2946 | forceCgi = find_option("cgi", 0, 0)!=0; |
| 2947 | fullHttpReply = find_option("http", 0, 0)!=0; |
| 2948 | fNoPrintRc = find_option("no-print-result",0,0)!=0; |
| 2949 | if( fullHttpReply ) forceCgi = 1; |
| 2950 | if( forceCgi ) Th_ForceCgi(fullHttpReply); |
| 2951 | if( find_option("open-config", 0, 0)!=0 ){ |
| 2952 | Th_OpenConfig(1); |
| 2953 | } |
| @@ -2965,11 +2968,14 @@ | |
| 2968 | blob_zero(&in); |
| 2969 | blob_read_from_file(&in, g.argv[2], ExtFILE); |
| 2970 | Th_FossilInit(TH_INIT_DEFAULT); |
| 2971 | rc = Th_Eval(g.interp, 0, blob_str(&in), -1); |
| 2972 | zRc = Th_ReturnCodeName(rc, 1); |
| 2973 | if(0==fNoPrintRc){ |
| 2974 | fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", |
| 2975 | Th_GetResult(g.interp, 0)); |
| 2976 | } |
| 2977 | Th_PrintTraceLog(); |
| 2978 | if( forceCgi ) cgi_reply(); |
| 2979 | } |
| 2980 | |
| 2981 | #ifdef FOSSIL_ENABLE_TH1_HOOKS |
| 2982 |