From 417536f1b587140cd8354a219c037890c752e2e6 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 14 Dec 2021 17:55:48 +0100 Subject: [PATCH] Switching subprocess commands to recommended ones Switched out all `subprocess.Popen` statements for `subprocess.run` since they are the more recommended and less low-level versions. --- jrnlwarrior.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jrnlwarrior.py b/jrnlwarrior.py index b73d1a9..7f206fe 100755 --- a/jrnlwarrior.py +++ b/jrnlwarrior.py @@ -95,7 +95,7 @@ def log_completed_to_taskwarrior(task_string, date, options): if options.dryrun: print(cmd) return - subprocess.Popen(cmd) + subprocess.run(cmd) def handle_open_tasks(line, date, options): @@ -123,7 +123,7 @@ def add_incomplete_to_taskwarrior(task_string, date, options): if options.dryrun: print(cmd) return - subprocess.Popen(cmd) + subprocess.run(cmd) def handle_idea(line, options): @@ -150,7 +150,7 @@ def add_idea_to_taskwarrior(idea_string, options): if options.dryrun: print(cmd) return - subprocess.Popen(cmd) + subprocess.run(cmd) def get_prio_string(task_string): @@ -192,7 +192,7 @@ def is_today(cur_date): def add_today(fname, options): cmd = ["task", *options.taskwarrior_overrides, "+TODAY or +OVERDUE", "export"] - due_json = json.loads(subprocess.run(cmd,capture_output=True).stdout) + due_json = json.loads(subprocess.run(cmd, capture_output=True).stdout) tasks = f"[{TODAY} 09:00] {options.todo_block_title}\n" for task in due_json: @@ -209,6 +209,7 @@ def add_today(fname, options): write_file.write(read_file.read()) os.rename(repl_fname, fname) + if __name__ == "__main__": process_file(opts.init()) sys.exit(0)