-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
642fc23
commit ff52a36
Showing
5 changed files
with
51 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
runner/src/main/kotlin/me/blueamethyst/bluecloud/runner/ProcessRegistry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
runner/src/main/kotlin/me/blueamethyst/bluecloud/runner/impl/screen/UnixScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.blueamethyst.bluecloud.runner.impl.screen | ||
|
||
import java.nio.file.Path | ||
|
||
class UnixScreen( | ||
val name: String, | ||
val command: MutableList<String>, | ||
) { | ||
|
||
fun create(): ProcessBuilder { | ||
return ProcessBuilder(buildCommand()) | ||
} | ||
|
||
private fun buildCommand(): MutableList<String> { | ||
return buildList { | ||
add("screen") | ||
add("-dmS") | ||
add(name) | ||
addAll(command) | ||
}.toMutableList() | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/main/kotlin/me/blueamethyst/bluecloud/runner/impl/screen/UnixScreenServiceProcess.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.blueamethyst.bluecloud.runner.impl.screen | ||
|
||
import me.blueamethyst.bluecloud.api.service.ICloudService | ||
import me.blueamethyst.bluecloud.runner.AbstractServiceProcess | ||
|
||
class UnixScreenServiceProcess: AbstractServiceProcess() { | ||
lateinit var unixScreen: UnixScreen; private set | ||
lateinit var process: Process; private set | ||
|
||
override fun start(service: ICloudService, command: MutableList<String>) { | ||
unixScreen = UnixScreen("bluecloud-${service.getId()}", command) | ||
process = unixScreen.create().start() | ||
} | ||
|
||
override fun stop() { | ||
process.destroy() | ||
} | ||
|
||
override fun kill() { | ||
process.destroy() | ||
} | ||
} |