Bug 1027232 - Restart b2g #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,18 @@ Host.prototype = { | |
'tcp:' + DEFAULT_PORT]); | ||
adb.on('close', function() { | ||
debug('Set adb forward to ' + port); | ||
callback(); | ||
var adbStart = spawn('adb', ['shell', 'stop', 'b2g']); | ||
adbStart.on('close', function() { | ||
|
||
var adbStop = spawn('adb', ['shell', 'start', 'b2g']); | ||
adbStop.on('close', function() { | ||
// Note: you need to wait for marionette to be ready. | ||
// The marionette client should do that for you. | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1033402 | ||
// Callback still needs to be called Asynchronously | ||
setTimeout(callback, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merely an FYI here: you could leave off the 0 here, or since it's Node, you can use the much more efficient There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to avoid Node specific stuff if I can :-) I have seen setTimeout(callback, 0) elsewhere. MDN doesn't tell us that the delay is an optional parameter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we just call the callback, we should be good since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope it doesn't work if I just call the callback. I actually tried that. I didn't dig the problem but the setTimeout did the trick. |
||
}); | ||
}); | ||
}); | ||
adb.stdout.on('data', function (data) { | ||
console.error('(start) stdout: ' + data); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug code. because it is useful when you need to diagnose. not sure what your question is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't see that this was called after the adb port forward command finished