Skip to content

Commit

Permalink
Return 0 as exit code if autotrash --install is successful
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen authored and bneijt committed Apr 1, 2023
1 parent eb2b05c commit d3d85ff
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/autotrash/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ def process_path(trash_info_path, options, stats, os_access) -> int:
def install_service(options, args):
if shutil.which("systemctl") is None:
logging.error("system must support systemd to use --install")
return
return 1

if options.dryrun:
logging.error("cannot install with --dry-run enabled")
return
return 1

executable_path = shutil.which("autotrash")
if executable_path is None:
Expand Down Expand Up @@ -435,6 +435,8 @@ def install_service(options, args):
subprocess.check_output(["systemctl", "--user", "start", "autotrash"])
logging.info("service is working")

return 0


def cli():
# Load and set configuration options
Expand All @@ -455,8 +457,7 @@ def cli():
check_options(parser, options)

if options.install:
install_service(options, args)
return 1
return install_service(options, args)

# Compile list of possible trash directories
trash_paths = find_trash_directories(options.trash_path, options.trash_mounts)
Expand Down

0 comments on commit d3d85ff

Please sign in to comment.