diff options
author | Ron Yorston <rmy@pobox.com> | 2013-05-24 15:56:07 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-05-24 15:56:07 +0100 |
commit | 6392ae0444fe13ea0e62021247bf0dcab5bc7f23 (patch) | |
tree | 45b83806f68f42633ddbd9dbfd31914df4512b71 | |
parent | 88b8cb61e8fb1db9026518c2302331b30146b9f2 (diff) | |
download | busybox-w32-6392ae0444fe13ea0e62021247bf0dcab5bc7f23.tar.gz busybox-w32-6392ae0444fe13ea0e62021247bf0dcab5bc7f23.tar.bz2 busybox-w32-6392ae0444fe13ea0e62021247bf0dcab5bc7f23.zip |
ash: add noconsole option to hide console window on WIN32
When a shell script is spawned from a GUI application a console
window is displayed. If the noconsole option is set the console
window is hidden.
-rw-r--r-- | shell/ash.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 80a85b9eb..8f59dccda 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -281,6 +281,9 @@ static const char *const optletters_optnames[] = { | |||
281 | ,"\0" "nolog" | 281 | ,"\0" "nolog" |
282 | ,"\0" "debug" | 282 | ,"\0" "debug" |
283 | #endif | 283 | #endif |
284 | #if ENABLE_PLATFORM_MINGW32 | ||
285 | ,"\0" "noconsole" | ||
286 | #endif | ||
284 | }; | 287 | }; |
285 | 288 | ||
286 | #define optletters(n) optletters_optnames[n][0] | 289 | #define optletters(n) optletters_optnames[n][0] |
@@ -361,6 +364,9 @@ struct globals_misc { | |||
361 | # define nolog optlist[14 + ENABLE_ASH_BASH_COMPAT] | 364 | # define nolog optlist[14 + ENABLE_ASH_BASH_COMPAT] |
362 | # define debug optlist[15 + ENABLE_ASH_BASH_COMPAT] | 365 | # define debug optlist[15 + ENABLE_ASH_BASH_COMPAT] |
363 | #endif | 366 | #endif |
367 | #if ENABLE_PLATFORM_MINGW32 | ||
368 | # define noconsole optlist[14 + ENABLE_ASH_BASH_COMPAT + 2*DEBUG] | ||
369 | #endif | ||
364 | 370 | ||
365 | /* trap handler commands */ | 371 | /* trap handler commands */ |
366 | /* | 372 | /* |
@@ -13818,6 +13824,15 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
13818 | } | 13824 | } |
13819 | #endif | 13825 | #endif |
13820 | procargs(argv); | 13826 | procargs(argv); |
13827 | #if ENABLE_PLATFORM_MINGW32 | ||
13828 | if ( noconsole ) { | ||
13829 | DWORD dummy; | ||
13830 | |||
13831 | if ( GetConsoleProcessList(&dummy, 1) == 1 ) { | ||
13832 | ShowWindow(GetConsoleWindow(), SW_HIDE); | ||
13833 | } | ||
13834 | } | ||
13835 | #endif | ||
13821 | 13836 | ||
13822 | if (argv[0] && argv[0][0] == '-') | 13837 | if (argv[0] && argv[0][0] == '-') |
13823 | isloginsh = 1; | 13838 | isloginsh = 1; |