提交 #1
This commit is contained in:
45
build/lite/run_shell_cmd_debug.py
Executable file
45
build/lite/run_shell_cmd_debug.py
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2020 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
with open("/home/andy/harmony/PowerHarmony_PHM_SDK_V1.0.1.0/shell_cmd_log.log",mode="a+") as f:
|
||||
print(f"{__file__} | shell_cmd:",file=f)
|
||||
for item in sys.argv[1:]:
|
||||
print(item,file=f)
|
||||
|
||||
# ret=subprocess.Popen(' '.join(sys.argv[1:]), shell=True).wait()
|
||||
with os.popen("pwd") as p:
|
||||
lines=p.readlines()
|
||||
for item in lines:
|
||||
print(f"pwd= {item}",file=f)
|
||||
with os.popen(' '.join(sys.argv[1:])) as p:
|
||||
lines=p.readlines()
|
||||
for item in lines:
|
||||
print(item)
|
||||
print(item,file=f)
|
||||
ret=0
|
||||
print(f"ret = {ret}",file=f)
|
||||
return ret
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
Reference in New Issue
Block a user