forked from dptech-corp/dpgen2
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
- Loading branch information
1 parent
fe0fa83
commit 21bad63
Showing
3 changed files
with
13 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
import sys, subprocess | ||
from dflow.utils import run_command as dflow_run_command | ||
from typing import Tuple, Union, List | ||
|
||
def run_command( | ||
cmd, | ||
cmd : Union[str, List[str]], | ||
shell: bool = False, | ||
): | ||
pp = subprocess.Popen( | ||
) -> Tuple[int, str, str]: | ||
return dflow_run_command( | ||
cmd, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
shell=shell, | ||
raise_error=False, | ||
try_bash=shell, | ||
) | ||
out, err = pp.communicate() | ||
return_code = pp.poll() | ||
out = out.decode(sys.stdin.encoding) | ||
err = err.decode(sys.stdin.encoding) | ||
return return_code, out, err | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters