Skip to content

Commit

Permalink
Update dependencies (1.5.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
e3ndr committed Sep 20, 2024
1 parent 42fb26c commit 4cabf41
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
27 changes: 15 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>xyz.e3ndr</groupId>
<artifactId>ConsoleUtil</artifactId>
<version>1.5.3</version>
<version>1.5.4</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -73,6 +73,10 @@
</build>

<repositories>
<repository>
<id>casterlabs-maven</id>
<url>https://repo.casterlabs.co/maven</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
Expand Down Expand Up @@ -102,22 +106,21 @@
</dependency>

<dependency>
<groupId>co.casterlabs.Commons</groupId>
<artifactId>Platform</artifactId>
<version>1.4.1</version>
<groupId>co.casterlabs.commons</groupId>
<artifactId>platform</artifactId>
<version>1.8.0-1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>co.casterlabs.Rakurai</groupId>
<artifactId>Json</artifactId>
<version>1.17.7</version>
<scope>provided</scope>
<groupId>co.casterlabs.commons</groupId>
<artifactId>io</artifactId>
<version>1.8.0-1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>co.casterlabs.Rakurai</groupId>
<artifactId>Util</artifactId>
<version>1.17.7</version>
<groupId>co.casterlabs</groupId>
<artifactId>rson</artifactId>
<version>1.18.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import java.awt.Dimension;
import java.io.IOException;
import java.nio.charset.Charset;

import co.casterlabs.rakurai.io.IOUtil;
import co.casterlabs.commons.io.streams.StreamUtil;
import lombok.NonNull;

public class UnixPlatformHandler implements PlatformHandler {
Expand Down Expand Up @@ -45,10 +46,11 @@ public static boolean isGnome() {

@Override
public Dimension getSize() throws IOException, InterruptedException {
String[] sizeResult = IOUtil.readString(
String[] sizeResult = StreamUtil.toString(
new ProcessBuilder("stty", "size")
.start()
.getInputStream()
.getInputStream(),
Charset.defaultCharset()
)
.trim()
.split(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import java.awt.Dimension;
import java.io.IOException;
import java.lang.ProcessBuilder.Redirect;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

import co.casterlabs.rakurai.io.IOUtil;
import co.casterlabs.commons.io.streams.StreamUtil;
import lombok.NonNull;

public class WindowsPlatformHandler implements PlatformHandler {
Expand All @@ -15,7 +16,7 @@ public class WindowsPlatformHandler implements PlatformHandler {

static {
try {
String script = IOUtil.readString(WindowsPlatformHandler.class.getResourceAsStream("/consoleutil/windows/setup.ps1"));
String script = StreamUtil.toString(WindowsPlatformHandler.class.getResourceAsStream("/consoleutil/windows/setup.ps1"), Charset.defaultCharset());
script = String.format("& {\n%s\n}", script);

setupScriptEncoded = encodeScript(script);
Expand All @@ -24,7 +25,7 @@ public class WindowsPlatformHandler implements PlatformHandler {
}

try {
String script = IOUtil.readString(WindowsPlatformHandler.class.getResourceAsStream("/consoleutil/windows/size.ps1"));
String script = StreamUtil.toString(WindowsPlatformHandler.class.getResourceAsStream("/consoleutil/windows/size.ps1"), Charset.defaultCharset());
script = String.format("& {\n%s\n}", script);

sizeScriptEncoded = encodeScript(script);
Expand Down Expand Up @@ -72,7 +73,7 @@ public Dimension getSize() throws IOException, InterruptedException {
Process process = powershell(sizeScriptEncoded);
process.waitFor();

String result = IOUtil.readString(process.getInputStream()).trim();
String result = StreamUtil.toString(process.getInputStream(), Charset.defaultCharset()).trim();
String[] sizes = result.split(",");

int width = 0;
Expand Down

0 comments on commit 4cabf41

Please sign in to comment.