Python子进程在Google云函数中不起作用

Python子进程在Google云函数中不起作用,python,google-cloud-platform,google-cloud-functions,subprocess,Python,Google Cloud Platform,Google Cloud Functions,Subprocess,我需要在Google Cloud函数中通过Python中的子进程执行一些进程 import subprocess import os def hello_world(request): print(subprocess.call(["echo", "hello","world"])) 预期产出: 你好,世界 实际产量: 0 google函数是否会阻止子流程的执行,或者我是否需要以不同的方式接收输出可以使用子流程。如果要返回子流程调用的输出,而不是退出代码,则必须使用子流程。请检查\u

我需要在Google Cloud函数中通过Python中的子进程执行一些进程

import subprocess
import os
def hello_world(request):
    print(subprocess.call(["echo", "hello","world"]))
预期产出: 你好,世界

实际产量: 0


google函数是否会阻止子流程的执行,或者我是否需要以不同的方式接收输出

可以使用
子流程
。如果要返回子流程调用的输出,而不是退出代码,则必须使用
子流程。请检查\u output()
(并返回结果):

导入子流程
def hello_world(请求):
返回子进程。检查_输出([“echo”,“hello world'))
但是,如果您只是尝试返回一个字符串,那么这是不必要的,以下内容就足够了:

def hello_world(请求):
返回“你好,世界”