-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #715 from koordinates/exec-comments
Exec refactor
- Loading branch information
Showing
7 changed files
with
59 additions
and
39 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 |
---|---|---|
|
@@ -76,6 +76,7 @@ pytest.xml | |
docs/_build/ | ||
*.code-workspace | ||
.vscode/ | ||
.idea/ | ||
|
||
*.p12 | ||
kart/_env.py | ||
|
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
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,30 +1,3 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
from . import is_windows | ||
from .cli_util import tool_environment | ||
|
||
|
||
def _kart_no_exec(cmd, args, env): | ||
# used in testing. This is pretty hackzy | ||
p = subprocess.run([cmd] + args[1:], capture_output=True, encoding="utf-8", env=env) | ||
sys.stdout.write(p.stdout) | ||
sys.stdout.flush() | ||
sys.stderr.write(p.stderr) | ||
sys.stderr.flush() | ||
sys.exit(p.returncode) | ||
|
||
|
||
def run_and_wait(cmd, args): | ||
""" | ||
run a process and wait for it to exit, this is required | ||
when in helper mode as execvpe overwrites the process so | ||
the caller can't be notified when the command is complete | ||
""" | ||
env = tool_environment(os.environ) | ||
if "_KART_NO_EXEC" in os.environ: | ||
_kart_no_exec(cmd, args, env) | ||
else: | ||
p = subprocess.run([cmd] + args[1:], env=env, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr) | ||
sys.exit(p.returncode) |
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
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