turboFei commented on code in PR #2669:
URL: https://github.com/apache/incubator-kyuubi/pull/2669#discussion_r874357870
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/JpsApplicationOperation.scala:
##########
@@ -49,7 +50,7 @@ class JpsApplicationOperation extends ApplicationOperation {
if (runner == null) {
None
} else {
- val pb = "jps -ml" #| s"grep $tag"
+ val pb = s"$runner -ml" #| s"grep $tag"
try {
pb.lineStream_!.headOption
} catch {
Review Comment:
```
scala> val pb = "jps -ml" #| s"grep 123 456"
val pb: scala.sys.process.ProcessBuilder = ( [jps, -ml] #| [grep, 123, 456]
)
scala> pb.lineStream_!.headOption
^
warning: method lineStream_! in trait ProcessBuilder is deprecated
(since 2.13.0): use lazyLines_!
grep: 456: No such file or directory
java.io.IOException: Pipe closed
at
java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:260)
at java.io.PipedInputStream.receive(PipedInputStream.java:226)
at java.io.PipedOutputStream.write(PipedOutputStream.java:149)
at scala.sys.process.BasicIO$.loop$1(BasicIO.scala:263)
at scala.sys.process.BasicIO$.transferFullyImpl(BasicIO.scala:269)
at scala.sys.process.BasicIO$.transferFully(BasicIO.scala:250)
at
scala.sys.process.ProcessImpl$PipeThread.runloop(ProcessImpl.scala:181)
at
scala.sys.process.ProcessImpl$PipeSource.go$1(ProcessImpl.scala:197)
at
scala.sys.process.ProcessImpl$PipeSource.run(ProcessImpl.scala:200)
val res0: Option[String] = None
scala>
```
It seems that we do not need catch the exception, it will not throw
exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]