Skip to content

Commit 38e32fd

Browse files
committed
Update README and _exec_cmd to clarify shell usage configuration
1 parent bbbda21 commit 38e32fd

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
Then you should be able to run `sling --help` from command line.
1010

11+
## Environment Variables
12+
13+
| Variable | Description | Default |
14+
|---|---|---|
15+
| `SLING_PYTHON_USE_SHELL` | Set to `true` to run the sling binary with `shell=True` in subprocess calls. | `false` |
16+
1117
## Running a Extract-Load Task
1218

1319
### CLI

sling/sling/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ def _exec_cmd(
503503
if is_package(pkg):
504504
env["SLING_PACKAGE"] = pkg
505505

506-
use_shell = os.environ.get('SLING_PYTHON_USE_SHELL', 'true').lower() != 'false'
507-
cmd_args = cmd if use_shell else shlex.split(cmd)
506+
use_shell = os.environ.get('SLING_PYTHON_USE_SHELL', 'false').lower() == 'true'
507+
cmd_args = cmd if use_shell else shlex.split(cmd, posix=(os.name != 'nt'))
508508

509509
with Popen(
510510
cmd_args, shell=use_shell, env=env, stdin=stdin, stdout=stdout, stderr=stderr

0 commit comments

Comments
 (0)