MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / is_command_valid

Function is_command_valid

mssqlcli/util.py:21–36  ·  view source on GitHub ↗

Checks if command is recognized on machine. Used to determine installations of 'less' pager.

(command)

Source from the content-addressed store, hash-verified

19 return s
20
21def is_command_valid(command):
22 """
23 Checks if command is recognized on machine. Used to determine installations
24 of 'less' pager.
25 """
26 if not command:
27 return False
28
29 try:
30 # call command silentyly
31 with open(devnull, 'wb') as no_out:
32 subprocess.call(command, stdout=no_out, stderr=no_out)
33 except OSError:
34 return False
35 else:
36 return True

Callers 3

set_default_pagerMethod · 0.90
test_valid_commandMethod · 0.90
test_invalid_commandMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_valid_commandMethod · 0.72
test_invalid_commandMethod · 0.72