-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add some hints to using os.proc
with Mill
#2060
Comments
os.proc
with Millos.proc
with Mill
I've been doing something like stdout = os.ProcessOutput.Readlines(line => T.ctx().log.debug("[prefix] " + line)) where |
Although, I guess you'd want to do that for Too bad os.proc doesn't have an easy way to reuse groups of parameters, that's something I could use often. |
Another good place to mention Jvm.runSubprocess is https://com-lihaoyi.github.io/mill/mill/Extending_Mill.html#_custom_targets_commands which currently says
|
One thing that's worse about Jvm.runSubprocess is that if it exits with a nonzero exit code, it throws a generic Exception that doesn't say the command line that failed. With catch {
case e: os.SubprocessException =>
throw new RuntimeException(
"rollup failed with exit code " + e.result.exitCode,
e
)
} etc. Otherwise if a few commands run and their output is not so different-looking from each other, it's hard to tell which one failed. But since A different option would be to just log at the beginning the command line that will be run. |
I switched to catch {
case e: Exception =>
throw new RuntimeException("Error running webpack", e)
} but then the output is harder to scan:
|
I think this can be closed since #3275 makes |
Using
os.Inherit
for output is known to not show up when in client-server-mode. We should mention the use ofmill.modules.Jvm.runSubprocess
and also give suggestions which settings work best in Mill.Also, all links to
os-lib
in the documentation should go through a dedicated Mill-specific page, so that readers following it will have an option to read about those best practices. This could be the existing https://com-lihaoyi.github.io/mill/mill/External_References.html#_os_lib page, or some more dedicated.Related:
The text was updated successfully, but these errors were encountered: