Remove custom monitor timeout code. Fix issue with java template on windows host. (#339)

This commit is contained in:
Jon Gallant 2018-10-25 07:03:50 -07:00 коммит произвёл Ray Fang
Родитель 7425448297
Коммит 27360948dd
5 изменённых файлов: 11 добавлений и 25 удалений

Просмотреть файл

@ -1,7 +1,6 @@
include HISTORY.rst
include LICENSE
include README.md
include iotedgedev/monitor.js
include iotedgedev/template/*.*
recursive-include tests *
recursive-exclude * __pycache__

Просмотреть файл

@ -29,14 +29,13 @@ class IoTHub:
def monitor_events_node(self, timeout=0):
try:
if timeout == 0:
self.utility.call_proc(['iothub-explorer', '--login', self.envvars.IOTHUB_CONNECTION_STRING,
'monitor-events', self.envvars.DEVICE_CONNECTION_INFO.device_id], shell=not self.envvars.is_posix())
else:
monitor_js = os.path.join(os.path.split(__file__)[0], "monitor.js")
cmd = ['iothub-explorer', '--login', self.envvars.IOTHUB_CONNECTION_STRING, 'monitor-events', self.envvars.DEVICE_CONNECTION_INFO.device_id]
if timeout != 0:
cmd.extend(['--duration', timeout])
self.utility.call_proc(cmd, shell=not self.envvars.is_posix())
self.utility.call_proc(['node', monitor_js, self.envvars.IOTHUB_CONNECTION_STRING,
self.envvars.DEVICE_CONNECTION_INFO.device_id, timeout], shell=not self.envvars.is_posix())
except Exception as ex:
self.output.error("Problem while trying to call iothub-explorer. Please ensure that you have installed the iothub-explorer npm package with: npm i -g iothub-explorer.")
self.output.error(str(ex))

Просмотреть файл

@ -84,11 +84,11 @@ class Modules:
"-Dpackage={0}".format(group_id),
"-Drepository={0}".format(repo),
"-B"]
self.output.header(" ".join(cmd))
self.utility.exe_proc(cmd, cwd=cwd)
self.utility.exe_proc(cmd, shell=not self.envvars.is_posix(), cwd=cwd)
elif template == "nodejs":
self.utility.check_dependency("yo azure-iot-edge-module --help".split(), "To add new Node.js modules, the Yeoman tool and Azure IoT Edge Node.js module generator",
shell=not self.envvars.is_posix())
self.utility.check_dependency("yo azure-iot-edge-module --help".split(), "To add new Node.js modules, the Yeoman tool and Azure IoT Edge Node.js module generator")
cmd = "yo azure-iot-edge-module -n {0} -r {1}".format(name, repo)
self.output.header(cmd)
self.utility.exe_proc(cmd.split(), shell=not self.envvars.is_posix(), cwd=cwd)

Просмотреть файл

@ -1,12 +0,0 @@
const { spawn } = require('child_process');
var ls = spawn('iothub-explorer', ['monitor-events', '--login', process.argv[2], process.argv[3], '--duration', process.argv[4]], { shell: true }).on('error', function (err) { console.log(err); throw err });
ls.stdout.on('data', (data) => {
console.log(`${data}`);
});
ls.stderr.on('data', (data) => {
console.log(`ERROR: ${data}`);
});

Просмотреть файл

@ -46,9 +46,9 @@ class Utility:
self.output.error("Error while executing command: {0}. {1}".format(' '.join(params), str(e)))
return 1
def check_dependency(self, params, description, shell=False):
def check_dependency(self, params, description):
try:
self.exe_proc(params, shell=shell, suppress_out=True)
self.exe_proc(params, shell=not self.envvars.is_posix(), suppress_out=True)
except FileNotFoundError:
raise FileNotFoundError("{0} is required by the Azure IoT Edge Dev Tool. For installation instructions, see https://aka.ms/iotedgedevwiki.".format(description))