xref: /unit/test/unit/check/node.py (revision 1865:3c551b9721df)
11621Szelenkov@nginx.comimport os
2*1865So.canty@f5.comimport subprocess
31621Szelenkov@nginx.com
41621Szelenkov@nginx.com
51621Szelenkov@nginx.comdef check_node(current_dir):
6*1865So.canty@f5.com    if not os.path.exists(current_dir + '/node/node_modules'):
7*1865So.canty@f5.com        return None
8*1865So.canty@f5.com
9*1865So.canty@f5.com    try:
10*1865So.canty@f5.com        v_bytes = subprocess.check_output(['/usr/bin/env', 'node', '-v'])
11*1865So.canty@f5.com
12*1865So.canty@f5.com        return [str(v_bytes, 'utf-8').lstrip('v').rstrip()]
13*1865So.canty@f5.com
14*1865So.canty@f5.com    except subprocess.CalledProcessError:
15*1865So.canty@f5.com        return None
16