Skip to content

Commit

Permalink
Fix empty output (#22)
Browse files Browse the repository at this point in the history
If no output was produced, no `mv` should be done, as it would fail on
non-existent directory, e.g.:

```
mv: rename pkl_eval_multiple_empty_output/work/_generated_files/* to bazel-out/darwin_arm64-fastbuild/bin/tests/pkl_eval/pkl_eval_multiple_empty_output/*: No such file or directory
```
  • Loading branch information
srueg authored Oct 9, 2024
1 parent abab696 commit 6317523
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkl/private/run_pkl_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ fi

if [[ "$command" == eval ]]; then
if [ "$multiple_outputs" == true ]; then
mv "${working_dir}/_generated_files"/* "$expected_output"

if [ -d "${working_dir}/_generated_files" ]; then
mv "${working_dir}/_generated_files"/* "$expected_output"
fi
else
mv "${working_dir}/${expected_output}" "$expected_output"
mv "${working_dir}/${expected_output}" "$expected_output"
fi
fi
Empty file.
19 changes: 19 additions & 0 deletions tests/pkl_eval/srcs/multipleOutputsEmpty.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//

output {
files {}
}

0 comments on commit 6317523

Please sign in to comment.