Skip to content

Commit a02fbab

Browse files
committed
Fix some warning and doc syntax typo.
1 parent 209e814 commit a02fbab

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

build.mill

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ trait AcyclicModule extends ScalaModule {
4343
def scalacOptions = super.scalacOptions() ++ acyclicOptions() ++ Seq(
4444
"-deprecation",
4545
"-feature",
46+
"-language:implicitConversions",
47+
"-language:higherKinds",
4648
)
4749
}
4850

os/src/GlobInterpolator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package os
22

33
object GlobInterpolator {
44
class Interped(parts: Seq[String]) {
5-
def unapplySeq(s: String) = {
6-
val Seq(head, tail @ _*) = parts.map(java.util.regex.Pattern.quote)
5+
def unapplySeq(s: String): Option[List[String]] = {
6+
val Seq(head, tail @ _*) = parts.map(java.util.regex.Pattern.quote): @unchecked
77

88
val regex = head + tail.map("(.*)" + _).mkString
99
regex.r.unapplySeq(s)

os/src/ListOps.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import java.nio.file.attribute.BasicFileAttributes
1717
object list extends Function1[Path, IndexedSeq[Path]] {
1818
def apply(src: Path, sort: Boolean = true): IndexedSeq[Path] = {
1919
val arr = stream(src).toArray[Path]
20-
if (sort) arr.sorted
20+
if (sort) arr.sorted.toIndexedSeq
2121
else arr
2222
}
2323
def apply(src: Path): IndexedSeq[Path] = apply(src, true).toIndexedSeq
@@ -53,7 +53,7 @@ object list extends Function1[Path, IndexedSeq[Path]] {
5353
* saving time as compared to filtering them after the fact.
5454
*
5555
* By default, the paths are returned as a pre-order traversal: the enclosing
56-
* folder is occurs first before any of it's contents. You can pass in `preOrder =
56+
* folder occurs first before any of its contents. You can pass in `preOrder =
5757
* false` to turn it into a post-order traversal, such that the enclosing folder
5858
* occurs last after all it's contents.
5959
*
@@ -76,12 +76,12 @@ object walk {
7676
* you want `preOrder` to be `true` so the folder gets
7777
* created first.
7878
*
79-
* @param followLinks Whether or not to follow symlinks while walking; defaults
79+
* @param followLinks Whether to follow symlinks while walking; defaults
8080
* to false
8181
*
8282
* @param maxDepth The max depth of the tree you wish to walk; defaults to unlimited
8383
*
84-
* @param includeTarget Whether or not to include the given path as part of the walk.
84+
* @param includeTarget Whether to include the given path as part of the walk.
8585
* If `true`, does not raise an error if the given path is a
8686
* simple file and not a folder
8787
*/
@@ -109,12 +109,12 @@ object walk {
109109
* you want `preOrder` to be `true` so the folder gets
110110
* created first.
111111
*
112-
* @param followLinks Whether or not to follow symlinks while walking; defaults
112+
* @param followLinks Whether to follow symlinks while walking; defaults
113113
* to false
114114
*
115115
* @param maxDepth The max depth of the tree you wish to walk; defaults to unlimited
116116
*
117-
* @param includeTarget Whether or not to include the given path as part of the walk.
117+
* @param includeTarget Whether to include the given path as part of the walk.
118118
* If `true`, does not raise an error if the given path is a
119119
* simple file and not a folder
120120
*/
@@ -145,12 +145,12 @@ object walk {
145145
* you want `preOrder` to be `true` so the folder gets
146146
* created first.
147147
*
148-
* @param followLinks Whether or not to follow symlinks while walking; defaults
148+
* @param followLinks Whether to follow symlinks while walking; defaults
149149
* to false
150150
*
151151
* @param maxDepth The max depth of the tree you wish to walk; defaults to unlimited
152152
*
153-
* @param includeTarget Whether or not to include the given path as part of the walk.
153+
* @param includeTarget Whether to include the given path as part of the walk.
154154
* If `true`, does not raise an error if the given path is a
155155
* simple file and not a folder
156156
*/
@@ -179,12 +179,12 @@ object walk {
179179
* you want `preOrder` to be `true` so the folder gets
180180
* created first.
181181
*
182-
* @param followLinks Whether or not to follow symlinks while walking; defaults
182+
* @param followLinks Whether to follow symlinks while walking; defaults
183183
* to false
184184
*
185185
* @param maxDepth The max depth of the tree you wish to walk; defaults to unlimited
186186
*
187-
* @param includeTarget Whether or not to include the given path as part of the walk.
187+
* @param includeTarget Whether to include the given path as part of the walk.
188188
* If `true`, does not raise an error if the given path is a
189189
* simple file and not a folder
190190
*/
@@ -228,7 +228,7 @@ object walk {
228228
// rather than relying on `walkFileTree`, because `walkFileTree`
229229
// does the unintuitive thing when the `path` being walked is a
230230
// symlink to a directory (it just returns the symlink path and
231-
// does not walking)
231+
// does not walk)
232232
val ds = Files.newDirectoryStream(pathNIO)
233233
val iter = ds.iterator()
234234
try {

os/src/SubProcess.scala

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ sealed trait ProcessLike extends java.lang.AutoCloseable {
5151

5252
/**
5353
* Wait up to `millis` for the [[ProcessLike]] to terminate and all stdout and stderr
54-
* from the subprocess to be handled. By default waits indefinitely; if a time
54+
* from the subprocess to be handled. By default, waits indefinitely; if a time
5555
* limit is given, explicitly destroys the [[ProcessLike]] if it has not completed by
5656
* the time the timeout has occurred.
5757
*
@@ -152,7 +152,7 @@ class SubProcess(
152152
* @param async set this to `true` if you do not want to wait on the subprocess exiting
153153
* @param shutdownGracePeriod use this to override the default wait time for the subprocess
154154
* to gracefully exit before destroying it forcibly. Defaults to the `shutdownGracePeriod`
155-
* that was used to spawned the process, but can be set to 0
155+
* that was used to spawn the process, but can be set to 0
156156
* (i.e. force exit immediately) or -1 (i.e. never force exit)
157157
* or anything in between. Typically defaults to 100 milliseconds.
158158
*/
@@ -183,7 +183,7 @@ class SubProcess(
183183
/**
184184
* Alias for [[destroy]]
185185
*/
186-
def close() = wrapped.destroy()
186+
def close(): Unit = wrapped.destroy()
187187

188188
/**
189189
* Wait up to `millis` for the subprocess to terminate, by default waits
@@ -296,7 +296,7 @@ object SubProcess {
296296
out.toByteArray
297297
}
298298

299-
override def close() = wrapped.close()
299+
override def close(): Unit = wrapped.close()
300300
}
301301
}
302302

@@ -314,7 +314,7 @@ class ProcessPipeline(
314314
/**
315315
* String representation of the pipeline.
316316
*/
317-
def commandString = processes.map(_.wrapped.toString).mkString(" | ")
317+
def commandString: String = processes.map(_.wrapped.toString).mkString(" | ")
318318

319319
private[os] val brokenPipeHandler: Option[Thread] = brokenPipeQueue.map { queue =>
320320
new Thread(
@@ -326,7 +326,7 @@ class ProcessPipeline(
326326
if (brokenPipeIndex == processes.length) { // Special case signaling finished pipeline
327327
pipelineRunning = false
328328
} else {
329-
processes(brokenPipeIndex).destroyForcibly()
329+
processes(brokenPipeIndex).destroy(shutdownGracePeriod = 0)
330330
}
331331
}
332332
new Thread(
@@ -354,9 +354,7 @@ class ProcessPipeline(
354354
*/
355355
override def exitCode(): Int = {
356356
if (pipefail)
357-
processes.map(_.exitCode())
358-
.filter(_ != 0)
359-
.headOption
357+
processes.map(_.exitCode()).find(_ != 0)
360358
.getOrElse(0)
361359
else
362360
processes.last.exitCode()
@@ -383,7 +381,7 @@ class ProcessPipeline(
383381
* All processes in the pipeline are force-destroyed.
384382
*/
385383
override def destroyForcibly(): Unit = {
386-
processes.foreach(_.destroyForcibly())
384+
processes.foreach(_.destroy(shutdownGracePeriod = 0))
387385
}
388386

389387
/**

0 commit comments

Comments
 (0)