summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlec Scott <hi@alecbcs.com>2024-03-21 10:15:09 -0700
committerGitHub <noreply@github.com>2024-03-21 18:15:09 +0100
commit446c0f232528ddfde812f084d64b6cbe239c9992 (patch)
tree0c01dc73fa95756700fe14df45b988410bd72ab1 /lib
parentc4ce51c9bee1f1f2c637dca88d1f8567235e4aa0 (diff)
downloadspack-446c0f232528ddfde812f084d64b6cbe239c9992.tar.gz
spack-446c0f232528ddfde812f084d64b6cbe239c9992.tar.bz2
spack-446c0f232528ddfde812f084d64b6cbe239c9992.tar.xz
spack-446c0f232528ddfde812f084d64b6cbe239c9992.zip
Disable interactive editor when --batch if passed to checksum (#43102)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/checksum.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py
index e3e9c1a308..44478c61ce 100644
--- a/lib/spack/spack/cmd/checksum.py
+++ b/lib/spack/spack/cmd/checksum.py
@@ -183,7 +183,7 @@ def checksum(parser, args):
print()
if args.add_to_package:
- add_versions_to_package(pkg, version_lines)
+ add_versions_to_package(pkg, version_lines, args.batch)
def print_checksum_status(pkg: PackageBase, version_hashes: dict):
@@ -229,7 +229,7 @@ def print_checksum_status(pkg: PackageBase, version_hashes: dict):
tty.die("Invalid checksums found.")
-def add_versions_to_package(pkg: PackageBase, version_lines: str):
+def add_versions_to_package(pkg: PackageBase, version_lines: str, is_batch: bool):
"""
Add checksumed versions to a package's instructions and open a user's
editor so they may double check the work of the function.
@@ -282,5 +282,5 @@ def add_versions_to_package(pkg: PackageBase, version_lines: str):
tty.msg(f"Added {num_versions_added} new versions to {pkg.name}")
tty.msg(f"Open {filename} to review the additions.")
- if sys.stdout.isatty():
+ if sys.stdout.isatty() and not is_batch:
editor(filename)