fix #4005 - Windows native-image compile failure caused by SUBST collision#4006
fix #4005 - Windows native-image compile failure caused by SUBST collision#4006Gedochao merged 8 commits intoVirtusLab:mainfrom
Conversation
Gedochao
left a comment
There was a problem hiding this comment.
any chance for us to have an integration test for this?
While the solution looks good to me, I think it may be fragile without a test.
modules/cli/src/main/scala/scala/cli/packaging/NativeImage.scala
Outdated
Show resolved
Hide resolved
Working on it. A unit test to verify that Integration tests to verify
Integration test to verify the native-image interrupted cleanup:
|
modules/integration/src/test/scala/scala/cli/integration/PackageTestDefinitions.scala
Outdated
Show resolved
Hide resolved
modules/integration/src/test/scala/scala/cli/integration/PackageTestDefinitions.scala
Outdated
Show resolved
Hide resolved
|
There's a problem with the shutdown hook that shows up in manual testing so I'm converting it to a draft while I work on it. |
refactor MsvcEnvironment to hold windows-specific native-image code add logging to vcvars env capture add VSCMD_DEBUG=1 logging to vcvars64.bat capture
fc3ecec to
fb20bc4
Compare
The following changes are made when calling the GraalVM compiler:
availableDriveLetter()to exclude existingSUBSTeddrive letterstry/finallyblock for doing cleanup with a java shutdown hookSUBSTeddrive letteros.proc()The shutdown hook runs on JVM shutdown, including Ctrl-C and is more reliable than a
finallyblock for cleanup.Because
os.procitself creates a shutdown hook, it isn't used inside the cleanup method.For readability, (2 Windows command lines are called inside the cleanup method) a new method was created:
Although the code page is restored by the
run-native-image.batscript (see #3981), it is vulnerable to interruption byCtrl-C.