-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run without cmd window? (hidden) #325
Comments
Very interesting, had no idea about Try this:
|
No, i still get a black windows console. Tried: busybox sh -c "ENABLE_ASH_NOCONSOLE=1; sleep 10" |
A console window still exists but it's hidden as soon as possible. |
Ahhhh, so this is how it works. Thank you. Search for 1 hour now how to use that option. |
Is there any way to have something like this? And also have it working dinamically with these? There is an API: ShowWindow |
This works:
But |
Also be able to hide an interactive shell with |
Previously the 'noconsole' shell option could only be set as a shell command line option. Allow it to be changed from within the shell by 'set -o noconsole' or 'set +o noconsole'. The console window is now minimised rather than hidden. This makes it easier for the user to access the console when 'noconsole' is in effect. Adds 8-32 bytes. (GitHub issue #325)
The latest prerelease binaries allow the |
I've been trying out FRP-5181 and noticed that I'm now seeing console windows that weren't there before, specifically when running programs from gvim
IMHO, the original semantics are closer to the correct behavior. If I don't make a conscious decision about As a secondary observation: The change from |
One more issue I forgot to mention that I noticed while investigating the new check: Despite the |
Set 'noconsole' to match the actual state of the console (normal/ iconified) when the shell is started. Thus ShowWindow() will only be called if the actual state differs from the default or user defined state. Costs 20-24 bytes. (GitHub issue #325)
What sort of programs are you running in
It should be the other way round:
The first keeps the console iconified for three seconds. In the second the console is restored immediately. There's a commit to fix that on the 'noconsole2' branch. (Requires a trinary
I don't agree. When the console is hidden with |
I have busybox-w32 set as my shell so that commands such as set sh=sh shcf=-c sxq=\" So every external command involves ash even if the end program isn't a busybox-w32 app. I first noticed the change in behavior with
That sounds reasonable, too. Simplifying your example further:
If I start that command in FRP-5181 and then immediately minimize the console, after three seconds the console window will pop back up on its own. If my shell did this with the terminal on Linux I'd consider it broken.
Thank you! That looks a lot better. I tried it out, and it restores the original default (no decision) behavior in all the cases I tested.
Hmm, I did another isolated test, and you're right. However, when I https://github.com/skeeto/w64devkit/blob/ce97a11/src/busybox-002-fix-noconsole.patch (I'll drop this patch when By the way, it's so nice and convenient that I can debug and hack on busybox-w32 natively on Windows! I could drop a breakpoint on |
why is "hidden" removed? i prever hidden. can you add both options? |
Commit 67ed748 (ash: detect console state on shell start up) synchronised the noconsole option with the actual state of the window on shell start up. This is insufficient. The user can change the state of the window independently of the noconsole option, leading to confusion and unwanted iconification of the window when unrelated 'set' commands are issued. Detect the current console state on every call to options(). Saves 16-32 bytes. (GitHub issue #325)
The 'noiconify' option controls how the console window is concealed when the 'noconsole' option is used. The default is to iconify the console. When 'noiconify' is 'on' the console is hidden. Adds 8-16 bytes. (GitHub issue #325)
The thinking was that iconification was better as it allowed the user to access the console window if required.
OK. There's a new There are new prerelease binaries (PRE-5338 or above) which have this feature. |
@rmyorston My suggestion:
Furthermore, in my opinion they should be independent from each other, not like now that |
Sure, I know it isn't really no console, but it's too late to change the name now. I'm also happy with the way |
First: I'm just write this to have an exchange of opinions, not for else.
The So it was actually actually "live" for 10 year in the previous way and only in the last year has taken this confusing form. In my opinion all of this is currently conceptually wrong. Quote:
In my opinion the fact that currently in busybox the meaning of "hidden" is both really "hidden" or "minimized" doesn't make sense; if you follow this scheme ("hidden" as "not visible") then also when the windows is maximized but in background (behing other windows) is "hidden". My suggestion was to restoring the previous behaviour of PS: Another source of confusion is this: on Windows the meaning of "iconified" is probably more likely => hidden but with an icon in the systray (the one near the clock, not task-bar); some GUI programs support this. |
So what you call "confusing" is that If yes, then I don't think it's confusing, because the behavior is well defined, and I do think it's technically better, because now by default with I.e. everything which was possible previously is still possible now, but with an additional feature. Whether it's convenient or not is a matter of personal opinion and use cases, e.g. if you only care about hiding the window then it's probably less convenient, but I don't think there's any point in discussing it further, because it's subjective. If by "confusing" you meant something else, then please be more specific. |
The fact that "iconify" depends on "noconsole" is confusing. For me they are conceptually independent, they should be able to be in all these states:
Also as I already said "iconify" can't in any means mean minimized (in my opinion). |
The terminology is confusing.
Such is life. |
+1 There could be better names, and I don't think anyone is arguing otherwise. I also don't think many users would object to changing it to better names, which might be minor inconvenience in the short term, but not terrible. Another option is to make The thing is that it's also subjective, so no real point in arguing over it beyone making one's opinion public. The important thing is to ensure users can get the info, preferably easily, of what these options do. |
Hi I've used the previous versions of busybox to start busybox's make from the .BAT file which after some conditions are checked comes to the
line. The start of that BAT was initiated from my Windows GUI editor when pressed certain key. Up to the most recent busybox version after pressing the key, busybox's make would run but there would be no console window appearing for a moment covering big part of the screen, and now I see exactly that happens (a non-minimized window appears for some moments) whenever that make has to do something (and, interestingly, not when everything is current!?). I see here that there were indeed some changes in the related behavior and that there are new options now to configure the behavior of new console window appearing, but since I haven't had to configure anything up to now, I'm confused about what I should do and where actually. Can you suggest what I should actually change and where? Thanks. Edit: Most importantly I don't call shell explicitly there, just |
@janko-jj When you say 'the most recent busybox version' do you mean the latest release (FRP-5398) or prerelease (PRE-54xx)? Which editor are you using? I'd like to be able to reproduce the problem you're seeing. |
@janko-jj If you're currently using FRP-5398 it would be worth trying a prerelease binary, version PRE-5436 or greater. |
Hi, thanks. With Now preparing repro files I see that except for calling gcc I do call another busybox command inside of Makefile, here To reproduce the effect: you'd need SciTe https://www.scintilla.org/SciTEDownload.html (Sc1.exe as a single binary should be enough) Then put these files a new directory, there open
With 5301 no console, with 5398 console appears. I haven't had $HOME/.profile as I've observed it, and I'm not aware I've done anything else than simply copying busybox to path (and doing so renaming busybox64.exe to busybox.exe, I'm using 64 bit no-unicode exe on Windows 8.1, sorry for "MS unsupported", but busybox works). |
Is one of "no console" and "console appears" desirable and/or expected, while the other is unexpected or undesirable? If yes, which is which, and why is it expected or desirable to behave like so? Also, you should try the latest pre-release as well. As noted earlier, at least 5436 |
I've just downloaded Edit: if I understand correctly, the relevant commit could be Edit2: Now seeing the commit, I can imagine that the reason why the window appeared is that I also have links like the following to
|
@janko-jj Thanks for the instructions for reproducing the problem. I was able to use them to confirm that the issue here is the same as in #430: the editor hides the console host associated with the Your |
Many thanks. Now I still don't understand why it appeared to me that the console host didn't show every time the |
The hidden console host is revealed the second time a shell runs. (It's changed from hidden to iconified the first time. That's less noticeable.) So if |
Hi i actually got information on how to run a hidden console through this github issue. I use it to run a script using windows' task scheduler. One thing i noticed, running Does anyone have tips to mitigate this? |
@TechnoSparks Just update and the issue will disappear. |
@TechnoSparks |
@ale5000-git hi much thank you for the reply. It seems like the behaviour have changed completely because I just updated to a newer version of Windows 11 (insider Beta). This time, neither the prerelease or current version launches the script hidden but using Video showcasing a new window is spawned when using But With that being said, my issue within this issue have solved itself and the culprit was Windows. But the developer may be interested on the I noticed I didn't tell what |
🤦♂️ I totally forgot to test using tasksched specifically. Will update soon Update: Task Scheduler aligns with my findings above |
yes it seems with Windows Terminal a new window appears. Using "Windows Console Host" (conhost.exe) does not spawn a visible window, which is the correct behavior. Hopefully my comments here could be of use for any future readers. |
@TechnoSparks @rmyorston
@rmyorston |
How many issues are there? As far as I can tell, according to you, all of them are correct except the 2nd one "it only minimize", no? unless you consider this an issue "spawn a new window for an instant and then hide correctly", but this is not in busybox's control. It's "start" which launches the window, and once busybox starts running, it does what it's supposed to do and hides it. IIRC "start" does support non-default launch modes too, so that's probably what you should use when using "start". |
No, all are wrong except the first. Note: The point 3 doesn't use "start". |
busybox.exe is a console application. like any console app, if you run it from GUI (like explorer, or start), it first creates the window, and then starts running. If you want to launch it hidden from gui then you should check the gui docs how to do that. but busybox itself can't hide the window before it starts running, and it only starts running after the window is created. |
I believe Avih is right, and what you are experiencing is the correct behaviour. Since you are using Windows 10, you aren't using Windows Terminal as the default "host" like my machine does, so your no. 2 is the only discrepancy here. But in my opinion, that's Windows Terminal's problem and not really busybox-w32's. My personal summary, to launch busybox hidden:
|
If I use conhost.exe from |
@TechnoSparks |
Actually, the order doesn't matter. When multiple options are processed from the command line all the new values are set first and then any required actions happen. I see the problem with Windows Terminal not respecting the |
@rmyorston |
Is there a way to run a script via busybox64 but without cmd window?
I read about a noconsole option? How do i use it?
Also tried creating a .profile file with "export ENABLE_ASH_NOCONSOLE=1".
The text was updated successfully, but these errors were encountered: