зеркало из https://github.com/microsoft/TACO.git
When attempting to debug a device, we now check whether the web inspector is enabled
This commit is contained in:
Родитель
14c66d4b64
Коммит
6fea5b4241
|
@ -266,12 +266,32 @@ class IOSAgent implements ITargetPlatform {
|
|||
var portRange: string = util.format("null:%d,:%d-%d", this.webDebugProxyDevicePort, this.webDebugProxyPortMin, this.webDebugProxyPortMax);
|
||||
|
||||
var deferred = Q.defer();
|
||||
sharedState.webProxyInstance = child_process.spawn("ios_webkit_debug_proxy", ["-c", portRange]);
|
||||
// Since we want to read the (very sparse) output interactively,
|
||||
// we must make sure to the output of ios_webkit_debug_proxy is not buffered.
|
||||
// The OSX command "script" provides one way to do that
|
||||
sharedState.webProxyInstance = child_process.spawn("script", ["-q", "/dev/null", "ios_webkit_debug_proxy", "-c", portRange], { stdio: "pipe" });
|
||||
sharedState.webProxyInstance.on("error", function (err: Error) {
|
||||
deferred.reject(new Error(resources.getStringForLanguage(req, "UnableToDebug")));
|
||||
});
|
||||
// Allow some time for the spawned process to error out
|
||||
Q.delay(250).then(() => deferred.resolve({}));
|
||||
|
||||
if (buildInfo.options.indexOf("--device" !== -1)) {
|
||||
// This is enabling debugging for a device build: make sure that a device is attached
|
||||
sharedState.webProxyInstance.stdout.on("data", function (data: Buffer) {
|
||||
var dataStr = data.toString();
|
||||
if (dataStr.match(/Unable to connect to/)) {
|
||||
var error = new Error(resources.getStringForLanguage(req, "WebInspectorDisabled"));
|
||||
deferred.reject(error);
|
||||
}
|
||||
if (dataStr.match(/Connected :[0-9]+ to/)) {
|
||||
deferred.resolve();
|
||||
}
|
||||
});
|
||||
// Allow time to discover devices to register.
|
||||
Q.delay(10000).then(() => deferred.reject(new Error(resources.getStringForLanguage(req, "NoDevicesFound"))));
|
||||
} else {
|
||||
// Allow some time for the spawned process to error out
|
||||
Q.delay(250).then(() => deferred.resolve({}));
|
||||
}
|
||||
|
||||
deferred.promise.then(() => {
|
||||
buildInfo["webDebugProxyPort"] = this.webDebugProxyDevicePort;
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
"_RunSuccess.comment": "Message sent back to Visual Studio when it requests the build server to run a build and the attempt is successful (the application is running on the device)",
|
||||
"DebugSuccess": "Successfully Debugging on the device",
|
||||
"_DebugSuccess.comment": "Message sent back to Visual Studio when it requests the build server to debug a build and the attempt is successful (the debugger is running)",
|
||||
"WebInspectorDisabled": "The web inspector is not enabled on the device. Please enable it in Settings -> Safari -> Advanced -> Web Inspector",
|
||||
"_WebInspectorDisabled.comment": "Message sent back to the client when they request debugging for a device build but the device is not configured for debugging. The Settings -> Safari etc corresponds to a menu on the physical device.",
|
||||
"NoDevicesFound": "No devices found to debug. Please ensure that a device is connected and awake and retry.",
|
||||
"_NoDevicesFound.comment": "Message sent back to the client when they request debugging for a device build but no devices are discovered.",
|
||||
"ProvisioningFailed": "Installation failed: Check your provisioning profile",
|
||||
"_ProvisioningFailed.comment": "Message sent back to Visual Studio or user when it attempts to install an app on a device without an appropriate provisioning profile",
|
||||
"IOSSimNotFound": "****** ios-sim is not installed on path. `sudo npm install -g ios-sim` if you want this server to support emulator.",
|
||||
|
|
Загрузка…
Ссылка в новой задаче