Fix NPE when handling ExternalReader specs with null arguments (#882)

This commit is contained in:
Josh B
2025-01-14 04:51:09 -08:00
committed by Daniel Chao
parent 0bc1b7156e
commit 6c8e45b19a
@@ -1,5 +1,5 @@
/* /*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -107,7 +107,9 @@ final class ExternalReaderProcessImpl implements ExternalReaderProcess {
// This relies on Java/OS behavior around PATH resolution, absolute/relative paths, etc. // This relies on Java/OS behavior around PATH resolution, absolute/relative paths, etc.
var command = new ArrayList<String>(); var command = new ArrayList<String>();
command.add(spec.executable()); command.add(spec.executable());
command.addAll(spec.arguments()); if (spec.arguments() != null) {
command.addAll(spec.arguments());
}
var builder = new ProcessBuilder(command); var builder = new ProcessBuilder(command);
builder.redirectError(Redirect.INHERIT); // inherit stderr from this pkl process builder.redirectError(Redirect.INHERIT); // inherit stderr from this pkl process