Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sandbox Process Creation #437

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
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion examples/other_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import sys
from subprocess import PIPE, Popen

from security import safe_command

from sigopt import Connection


Expand All @@ -23,7 +25,7 @@ def evaluate_metric(self, assignments):
arguments = [
"--{}={}".format(param_name, assignment) for param_name, assignment in assignments.to_json().iteritems()
]
process = Popen(self.command.split() + arguments, stdout=PIPE, stderr=PIPE)
process = safe_command.run(Popen, self.command.split() + arguments, stdout=PIPE, stderr=PIPE)
(stdoutdata, stderrdata) = process.communicate()
sys.stderr.write(stderrdata)
return float(stdoutdata.strip())
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ packaging>=21.3
pypng>=0.0.20
PyYAML>=5,<7
requests>=2.25.0,<3.0.0
security>=1.2.1
urllib3>=1.26.5,<2.0.0
4 changes: 3 additions & 1 deletion sigopt/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import threading

import click
from security import safe_command

from sigopt.factory import SigOptFactory
from sigopt.run_context import GlobalRunContext
Expand Down Expand Up @@ -80,7 +81,8 @@ def run_subprocess_command(config, run_context, cmd, env=None):
env = get_subprocess_environment(config, run_context, env)
proc_stdout, proc_stderr = subprocess.PIPE, subprocess.PIPE
try:
proc = subprocess.Popen(
proc = safe_command.run(
subprocess.Popen,
cmd,
env=env,
stdout=proc_stdout,
Expand Down