Skip to content

Instantly share code, notes, and snippets.

@pjbeaman
Created November 29, 2012 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjbeaman/4165767 to your computer and use it in GitHub Desktop.
Save pjbeaman/4165767 to your computer and use it in GitHub Desktop.
Additional diagnostic output is no longer needed.
TL;DR:
mkbundled binaries on Windows WILL NOT write output to stdout/stderr,
and the process exit value is always 0 when invoked from CMD.EXE.
To view stdout/stderr, you need to redirect output to a file:
> license-check-bundled.exe > o.txt 2>e.txt
To view hte process exit code, you cannot launch from CMD.EXE.
DETAILS:
As for "what's wrong with the ... mkbundled license-check.exe." (as
mentioned in 4d5cd1cd)... Nothing is wrong with it...per-se.
The problem was that I was never seeing output from
license-check-bundled.exe, so 4d5cd1cd was added so that it would
ALWAYS generate output, providing a degree of "sanity checking."
Unfortunately, even after 4d5cd1cd, license-check-bundled.exe would
generate no output when invoked within CMD.EXE.
<<Insert gnashing of teeth here.>>
Test scenario: On Windows, replace monoandroid.licx with a 0-byte
file. (It's thus "corrupt.") Run license-check-bundled. from CMD.EXE:
> license-check-bundled.exe & echo %ERRORLEVEL%
0
Wat.
We'd always get 0 as the process exit value, and NO output would be
written to stdout/stderr, despite 4d5cd1cd ALWAYS printing output.
Wat?!
This led me to believe that the "separately uploaded"
license-check-bundled.exe differed from the one in the .msi, as the
.msi clearly had a non-0 return value (99 actually...).
Yet license-check.exe and mandroid.exe have the SAME mkbundle command;
if license-check.exe is failing, then surely mandroid should, right?
> mandroid.exe --activated & echo %ERRORLEVEL%
0
COMMENCE FULL FREAK-OUT MODE.
HOWEVER, launch Visual Studio, try to deploy, and Visual Studio
(properly) states that you're on the Evaluation version, so clearly
mandroid is doing The Right Thing wrt license checking.
Clearly something is FUBAR here: Run from CMD.EXE, no errors are
reported, and we never get program output. Run from VS or the
installer, and things work as expected.
WHAT THE FUCK IS GOING ON?!
What's going on is, apparently, the mkbundle process is FUBAR: neither
stdout nor stderr messages are ever written to a console, and the
process exit value is always 0 WHEN EXECUTED FROM CMD.EXE. Launch the
.exe from e.g. System.Diagnostics.Process, and things work.
Verification:
> license-check-bundled.exe > o.txt 2> e.txt & echo %ERRORLEVEL%
0
Exit value is still 0, but e.txt (stderr) now contains the output
expected from 4d5cd1cd. The same is true for mandroid.exe: the
expected error output for an invalid license is generated.
@Mixaill
Copy link

Mixaill commented Aug 18, 2013

THANKS MAN!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment