Skip to content

Commit

Permalink
ran run.py on windows, some fixes needed
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Jan 22, 2024
1 parent 7579f13 commit a3ae97e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sarracenia/flowcb/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import os
from sarracenia.flowcb import FlowCB
import subprocess

Expand Down Expand Up @@ -58,13 +59,14 @@ def __init__(self, options):
self.o.add_option('run_start', 'str')
self.o.add_option('run_stop', 'str')
self.o.add_option('run_housekeeping', 'str')
logger.info( f"run_work_itemis {self.o.run_work_item}")

def run_script(self, script):
try:
subprocess.run(script, check=True)
except Exception as err:
logging.error("subprocess.run failed err={}".format(err))
logging.debug("Exception details:", exc_info=True)
logger.error("subprocess.run failed err={}".format(err))
logger.debug("Exception details:", exc_info=True)

def gather(self):
"""
Expand All @@ -88,7 +90,7 @@ def after_accept(self, worklist):
if hasattr(self.o, 'run_accept_item' ) and self.o.run_accept_item:
for m in worklist.incoming:
cmd = self.o.run_accept_item.split()
cmd.append( f"{m['new_dir']}/{m['new_file']}" )
cmd.append( str(os.path.join(m['new_dir'], m['new_file'])))
try:
p = subprocess.Popen( cmd )
p.wait()
Expand All @@ -111,7 +113,7 @@ def after_work(self, worklist):
if hasattr(self.o, 'run_work_item' ) and self.o.run_work_item is not None:
for m in worklist.ok:
cmd = self.o.run_work_item.split()
cmd.append( f"{m['new_dir']}/{m['new_file']}" )
cmd.append( os.path.join(m['new_dir'], m['new_file']))
try:
p = subprocess.Popen( cmd )
p.wait()
Expand Down

0 comments on commit a3ae97e

Please sign in to comment.