Skip to content

Commit

Permalink
Simplify assertion in ExternalProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
dabico committed Dec 31, 2023
1 parent a7c8345 commit 02b6bcd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/ch/usi/si/seart/io/ExternalProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.util.Assert;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -70,11 +71,9 @@ public ExternalProcess(
@NotNull Map<String, String> environment,
@NotNull String... command
) {
if (!Files.isDirectory(workdir))
throw new IllegalArgumentException("Specified path is not a directory!");
Assert.isTrue(Files.isDirectory(workdir), "Specified path is not a directory!");
Objects.requireNonNull(environment, "Environment settings must not be null!");
Objects.requireNonNull(command, "Command and arguments must not be null!");

processBuilder = new ProcessBuilder();
processBuilder.environment().putAll(environment);
processBuilder.directory(workdir.toFile());
Expand Down

0 comments on commit 02b6bcd

Please sign in to comment.