Skip to content

apply strict mode everywhere #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions cwltool/sandboxjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def check_js_threshold_version(working_alias):

def new_js_proc(force_docker_pull=False, js_console=False):
# type: (bool, bool) -> subprocess.Popen

cwl_node_engine_js = 'cwlNodeEngine.js'
if js_console:
cwl_node_engine_js = 'cwlNodeEngineJSConsole.js'
Expand All @@ -73,7 +73,7 @@ def new_js_proc(force_docker_pull=False, js_console=False):
if subprocess.check_output([n, "--eval", "process.stdout.write('t')"]).decode('utf-8') != "t":
continue
else:
nodejs = subprocess.Popen([n, "--eval", nodecode],
nodejs = subprocess.Popen([n, "--use_strict", "--eval", nodecode],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
Expand Down Expand Up @@ -104,7 +104,8 @@ def new_js_proc(force_docker_pull=False, js_console=False):
nodejs = subprocess.Popen(["docker", "run",
"--attach=STDIN", "--attach=STDOUT", "--attach=STDERR",
"--sig-proxy=true", "--interactive",
"--rm", nodeimg, "node", "--eval", nodecode],
"--rm", nodeimg, "node", "--use_strict",
"--eval", nodecode],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
docker = True
except OSError as e:
Expand Down Expand Up @@ -166,7 +167,7 @@ def terminate():

PROCESS_FINISHED_STR = "r1cepzbhUTxtykz5XTC4\n"

def process_finished(): # type: () -> bool
def process_finished(): # type: () -> bool
return stdout_buf.getvalue().decode().endswith(PROCESS_FINISHED_STR) and \
stderr_buf.getvalue().decode().endswith(PROCESS_FINISHED_STR)

Expand Down Expand Up @@ -235,7 +236,7 @@ def get_error(error_queue):

if nodejs.stderr in rselect:
if not error_queue.empty():
stderr_buf.write(error_queue.get())
stderr_buf.write(error_queue.get())

if process_finished() and error_queue.empty() and output_queue.empty():
finished = True
Expand Down