Skip to content

use ProcessHandle instead of graalvm substitutions #2

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

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def tmpDirBase =

class Library(val crossScalaVersion: String) extends CrossScalaModule with LibDaemonPublish {
def artifactName = "libdaemon"
def compileIvyDeps = super.compileIvyDeps() ++ Seq(
ivy"org.graalvm.nativeimage:svm:21.2.0"
)
def javacOptions = super.javacOptions() ++ Seq(
"--release",
"16"
Expand Down
7 changes: 0 additions & 7 deletions library/src/libdaemonjvm/internal/IsRunning.java

This file was deleted.

18 changes: 0 additions & 18 deletions library/src/libdaemonjvm/internal/IsRunningSubst.java

This file was deleted.

13 changes: 6 additions & 7 deletions library/src/libdaemonjvm/internal/LockProcess.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ trait LockProcess {
object LockProcess {
class Default extends LockProcess {
def pid(): Int =
Option((new Pid).get()).map(n => (n: Int)).getOrElse {
sys.error("Cannot get PID")
}
def isRunning(pid: Int): Boolean =
Option((new IsRunning).isRunning(pid)).map(b => (b: Boolean)).getOrElse {
Processes.isRunning(pid)
}
ProcessHandle.current().pid().toInt
def isRunning(pid: Int): Boolean = {
val maybeHandle = ProcessHandle.of(pid)
if (maybeHandle.isEmpty) false
else maybeHandle.get.isAlive
}
}

def default: LockProcess =
Expand Down
16 changes: 0 additions & 16 deletions library/src/libdaemonjvm/internal/Pid.java

This file was deleted.

18 changes: 0 additions & 18 deletions library/src/libdaemonjvm/internal/PidSubst.java

This file was deleted.

32 changes: 0 additions & 32 deletions library/src/libdaemonjvm/internal/Processes.scala

This file was deleted.

Loading