Skip to content
Merged
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
2 changes: 1 addition & 1 deletion core/pythonActionLoop/pythonbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def build(source_dir, target_file, launcher):
if os.path.isfile(main):
cmd += """
cd %s
exec python %s "$@"
exec "$(which python)" %s "$@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test with an action to check that sys.executable is not empty?

""" % (source_dir, launcher)
else:
cmd += """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,4 +438,22 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys
e should include("Traceback")
})
}

it should "have a valid sys.executable" in {
withActionContainer() { c =>
val code =
"""
|import sys
|def main(args):
| return { "sys": sys.executable }
""".stripMargin

val (initCode, res) = c.init(initPayload(code))
initCode should be(200)

val (runCode, runRes) = c.run(runPayload(JsObject()))
runCode should be(200)
runRes.get.fields.get("sys").get.toString() should include("python")
}
}
}