From 9595dd37e69191914399a12730099f6d6428e633 Mon Sep 17 00:00:00 2001 From: Luke Ceddia Date: Fri, 11 Dec 2015 13:02:44 +1100 Subject: [PATCH] Fixed the SHELL() function to return correct values on Linux (and presumably OSX). --- internal/c/libqb.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index fc9238849..09b74fbfe 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -18208,8 +18208,7 @@ int64 func_shell(qbs *str){ if (new_error) return 1; if (cloud_app){error(262); return 1;} - static int64 return_code; - return_code=0; + int64 return_code; //exit full screen mode if necessary static int32 full_screen_mode; @@ -18440,6 +18439,10 @@ int64 func_shell(qbs *str){ shell_call_in_progress=1; return_code = system((char*)strz->chr); shell_call_in_progress=0; + if (return_code == -1) {/* do nothing */} + else { + return_code = WEXITSTATUS(return_code); + } #endif @@ -33188,4 +33191,4 @@ sub__limit( 10 ); sub__display(); }while(1); //infinite loop (this function never exits) -} \ No newline at end of file +}