Skip to content

Commit c985ef8

Browse files
authored
Show gpg output in server/client in publish (fix #387) (#2059)
Avoid using `os.Inherit` which is known to break the output in server/client mode. Fixes #387 Checked manually and the errors now appear with and without `-i`. Pull request: #2059
1 parent 8751bd1 commit c985ef8

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

scalalib/src/PublishModule.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ trait PublishModule extends JavaModule { outer =>
177177
readTimeout,
178178
connectTimeout,
179179
T.log,
180+
T.workspace,
181+
T.env,
180182
awaitTimeout,
181183
stagingRelease
182184
).publish(artifacts.map { case (a, b) => (a.path, b) }, artifactInfo, release)
@@ -236,6 +238,8 @@ object PublishModule extends ExternalModule {
236238
readTimeout,
237239
connectTimeout,
238240
T.log,
241+
T.workspace,
242+
T.env,
239243
awaitTimeout,
240244
stagingRelease
241245
).publishAll(

scalalib/src/publish/SonatypePublisher.scala

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import java.math.BigInteger
44
import java.security.MessageDigest
55

66
import mill.api.Logger
7+
import mill.modules.Jvm
78
import os.Shellable
89

910
class SonatypePublisher(
@@ -15,9 +16,37 @@ class SonatypePublisher(
1516
readTimeout: Int,
1617
connectTimeout: Int,
1718
log: Logger,
19+
workspace: os.Path,
20+
env: Map[String, String],
1821
awaitTimeout: Int,
19-
stagingRelease: Boolean = true
22+
stagingRelease: Boolean
2023
) {
24+
@deprecated("Use other constructor instead", since = "mill 0.10.8")
25+
def this(
26+
uri: String,
27+
snapshotUri: String,
28+
credentials: String,
29+
signed: Boolean,
30+
gpgArgs: Seq[String],
31+
readTimeout: Int,
32+
connectTimeout: Int,
33+
log: Logger,
34+
awaitTimeout: Int,
35+
stagingRelease: Boolean = true
36+
) = this(
37+
uri = uri,
38+
snapshotUri = snapshotUri,
39+
credentials = credentials,
40+
signed = signed,
41+
gpgArgs = gpgArgs,
42+
readTimeout = readTimeout,
43+
connectTimeout = connectTimeout,
44+
log = log,
45+
workspace = os.pwd,
46+
env = sys.env,
47+
awaitTimeout = awaitTimeout,
48+
stagingRelease = stagingRelease
49+
)
2150

2251
private val api = new SonatypeHttpApi(
2352
uri,
@@ -174,8 +203,7 @@ class SonatypePublisher(
174203
val fileName = file.toString
175204
val command = "gpg" +: args :+ fileName
176205

177-
os.proc(command.map(v => v: Shellable))
178-
.call(stdin = os.Inherit, stdout = os.Inherit, stderr = os.Inherit)
206+
Jvm.runSubprocess(command, env, workspace)
179207
os.Path(fileName + ".asc")
180208
}
181209

0 commit comments

Comments
 (0)