Skip to content
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

Use --console logic automatically on Windows #29

Open
ctrueden opened this issue Mar 18, 2015 · 5 comments
Open

Use --console logic automatically on Windows #29

ctrueden opened this issue Mar 18, 2015 · 5 comments

Comments

@ctrueden
Copy link
Member

In many scenarios on Windows, it is necessary to pass the --console flag so that the console it attached correctly. Otherwise, no output will ever been shown.

This flag is unfortunate, and it would be best if we could get rid of it completely. But barring that, let's at least be smarter about automatically enabling the console attach feature in circumstances where it is known to be necessary, such as with --headless.

See also #10, #11.

@dscho
Copy link
Contributor

dscho commented Mar 23, 2015

undocumented --console flag

#ifdef WIN32
"--console\n"
"\talways open an error console\n"
"--set-icon <exe-file> <ico-file>\n"
"\tadd/replace the icon of the given program\n"
#endif

@dscho
Copy link
Contributor

dscho commented Mar 23, 2015

let's at least be smarter about automatically enabling the console attach feature in circumstances where it is known to be necessary, such as with --headless

When ImageJ is called from background processes, as is the case when using pseudo cluster software to make use of otherwise unused machines, the console is definitely not to be attached.

Worse, the reason to introduce the --console flag was that trying to attach a new console would open a new console if none was found. Totally undesirable behavior.

Thus, while this ticket was certainly well-intentioned, the problems are much, much harder than the report anticipates.

@ctrueden
Copy link
Member Author

@dscho Sorry for the "undocumented" comment—I ran with --help on my Mac and didn't see the option, so I made an ass out of U and me.

Thanks for explaining some of the difficulties if the situation is to improve. So it seems research will be needed into how to robustly avoid violating the Least Astonishment Principle in various circumstances. Quick searches seem to indicate it might be possible to attach a console without necessarily creating one (e.g., this API call in C++ purports to do so).

@teknowledgist
Copy link

I feel compelled to comment that (in Windows) including the --console flag appears to only (mostly) work with the downloads that include Java and not with system-installed Java. (All I tested was the --update flag though.)

For example, --update --console with the ImageJ or Fiji-noJRE downloads returns nothing except Warning: falling back to system Java. Using the same flags with the normal Fiji download returns the full list of update subcommands.

In all cases, the console appears to be waiting for the command to finish (with a blinking cursor at the far left and no empty prompt appearing). In actuality, the prompt is "invisible". I can type commands and they run (upon enter), or tab through the files in the directory. The normal prompt returns on enter.

Also, the output to the cmd window must not be standard output because it doesn't redirect (e.g. to a file).

@ctrueden
Copy link
Member Author

@teknowledgist Thanks, I have noticed some similar behaviors, and agree it is suboptimal, but I have neither the bandwidth nor particular expertise to fix it. Feel free to dig into the code. It should be pretty straightforward to make changes to the source, then rebuild and test using ./build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants