This is the mail archive of the cygwin-apps mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Feb 3 22:04, Corinna Vinschen wrote: > On Feb 3 21:37, Achim Gratz wrote: > > Corinna Vinschen writes: > > > On Feb 3 18:08, Achim Gratz wrote: > > >> Corinna Vinschen writes: > > >> > How so? Setup is not a Cygwin application. > > >> > > >> Good point. Then I've no idea at all, save the compiler. > > > > > > I had a look into this and even rearranged the behaviour when --help > > > output is requested... > > > > > > However, I'm mildly sure this behaviour didn't change in the last couple > > > of years. The reason is that setup is not a console application but a > > > GUI application. When running a GUI application from CMD, CMD will > > > detach. Of course, when --help output is requested, setup calls > > > AllocConsole, but that's too late. This does not occur in a Cygwin > > > shell becasue Cygwin always waits for process completion unless the > > > process is sent to the background. > > > > > > I now made the latest setup 2.864 available as standard setup version > > > on sourceware and removed the test releases. > > > > I'm not sure we're talking about the same thing. I've recently added > > code to print an error message along with the parameter usage when a > > wrong option or other non-parseable stuff was given instead of simply > > exiting with no indication other than the non-zero exit code. The > > changes you've just installed look good to me, but they don't touch the > > exit path in question: > > > > --8<---------------cut here---------------start------------->8--- > > if (!GetOption::GetInstance ().Process (argc,_argv, NULL)) > > - exit (1); > > + { > > + GetOption::GetInstance ().ParameterUsage (cerr > > + << "\nError during option processing." > > + << "\nCommand Line Options:\n"); > > + exit (1); > > + } > > --8<---------------cut here---------------end--------------->8--- > > > > I guess with those changes one could now use Log (LOG_TIMESTAMP) instead > > of cerr in that place and hopefully the output would appear again? I > > was pretty certain I tested that in both mintty and CMD, but maybe > > not... > > I was referring explicitely to the CMD prompt being too early. I didn't > test the situation when specifying a wrong option, sorry. The point in > the file where this occurs is somewhat early. At this point the log > stuff isn't initialized and AttachConsole hasn't been called. I'll > look into that, maybe it can be fixed easily. Try this: Index: main.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/main.cc,v retrieving revision 2.79 diff -u -p -r2.79 main.cc --- main.cc 3 Feb 2015 19:51:49 -0000 2.79 +++ main.cc 3 Feb 2015 21:27:31 -0000 @@ -227,17 +227,16 @@ WinMain (HINSTANCE h, _argv = __argv; try { + bool help_option = false; + bool invalid_option = false; char cwd[MAX_PATH]; GetCurrentDirectory (MAX_PATH, cwd); local_dir = std::string (cwd); if (!GetOption::GetInstance ().Process (argc,_argv, NULL)) - { - GetOption::GetInstance ().ParameterUsage (cerr - << "\nError during option processing." - << "\nCommand Line Options:\n"); - exit (1); - } + help_option = invalid_option = true; + else if (HelpOption) + help_option = true; if (!((string) Arch).size ()) { @@ -264,7 +263,7 @@ WinMain (HINSTANCE h, unattended_mode = PackageManagerOption ? chooseronly : (UnattendedOption ? unattended : attended); - if (unattended_mode || HelpOption) + if (unattended_mode || help_option) set_cout (); /* Get System info */ @@ -275,7 +274,7 @@ WinMain (HINSTANCE h, supposed to elevate. */ nt_sec.initialiseWellKnownSIDs (); /* Check if we have to elevate. */ - bool elevate = !HelpOption && version.dwMajorVersion >= 6 + bool elevate = !help_option && version.dwMajorVersion >= 6 && !NoAdminOption && !nt_sec.isRunAsAdmin (); /* Start logging only if we don't elevate. Same for setting default @@ -284,7 +283,7 @@ WinMain (HINSTANCE h, const char *sep = isdirsep (local_dir[local_dir.size () - 1]) ? "" : "\\"; /* Don't create log files for help output only. */ - if (!elevate && !HelpOption) + if (!elevate && !help_option) { theLog->setFile (LOG_BABBLE, local_dir + sep + "setup.log.full", false); @@ -293,8 +292,10 @@ WinMain (HINSTANCE h, << setup_version << endLog; } - if (HelpOption) + if (help_option) { + if (invalid_option) + Log (LOG_PLAIN) << "\nError during option processing." << endLog; Log (LOG_PLAIN) << "\nCommand Line Options:\n" << endLog; GetOption::GetInstance ().ParameterUsage (Log (LOG_PLAIN)); Log (LOG_PLAIN) << endLog; Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
Attachment:
pgp4BGFLe6Ost.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |