Merge pull request #506 from KrzysiekJ/preferred-shell
Use $SHELL in the shell module
This commit is contained in:
commit
cede2de42c
1 changed files with 3 additions and 1 deletions
|
@ -11,7 +11,7 @@ Few command examples:
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* shell.command: Command to execute
|
* shell.command: Command to execute
|
||||||
Use single parentheses if evaluating anything inside
|
Use single parentheses if evaluating anything inside (sh-style)
|
||||||
For example shell.command='echo $(date +"%H:%M:%S")'
|
For example shell.command='echo $(date +"%H:%M:%S")'
|
||||||
But NOT shell.command="echo $(date +'%H:%M:%S')"
|
But NOT shell.command="echo $(date +'%H:%M:%S')"
|
||||||
Second one will be evaluated only once at startup
|
Second one will be evaluated only once at startup
|
||||||
|
@ -23,6 +23,7 @@ Parameters:
|
||||||
(defaults to False)
|
(defaults to False)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ class Module(bumblebee.engine.Module):
|
||||||
def _get_command_output_or_error(command):
|
def _get_command_output_or_error(command):
|
||||||
try:
|
try:
|
||||||
command_output = subprocess.check_output(command,
|
command_output = subprocess.check_output(command,
|
||||||
|
executable=os.environ.get('SHELL'),
|
||||||
shell=True,
|
shell=True,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
return command_output.decode('utf-8').strip()
|
return command_output.decode('utf-8').strip()
|
||||||
|
|
Loading…
Reference in a new issue