-
-
Notifications
You must be signed in to change notification settings - Fork 204
feat: windows #6065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: windows #6065
Changes from 1 commit
b5171b8
ba29271
a2a6041
2fc8ca7
3d97912
5bbe284
1ee87fc
dbff762
77609c0
6c26545
b2a6cb5
32f33ff
ae5c765
c9d9c4f
8f03ee4
bc517c0
f73ecf7
c702308
1dbb30b
7a54c25
95cc0ed
c7f8432
e5ef0ac
ea72c74
0f05f01
2053117
c80a64b
6286e82
eecb511
a299797
86dd40c
e9be2f0
69f2c1f
3c839a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import * as fs from "fs"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { DeviceLiveSyncServiceBase } from "./device-livesync-service-base"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { IPlatformsDataService } from "../../definitions/platform"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { IProjectData } from "../../definitions/project"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -18,10 +19,19 @@ export class WindowsDeviceLiveSyncService | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectData: IProjectData, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _liveSyncInfo: ILiveSyncResultInfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO: kill the running Windows app process and relaunch it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.$logger.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `[Windows LiveSync] Restart required for ${projectData.projectName}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `[Windows LiveSync] Restarting application ${projectData.projectName}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const appId = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectData.projectIdentifiers?.["windows"] ?? projectData.projectId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.device.applicationManager.restartApplication({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| appId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectName: projectData.projectName, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| projectDir: projectData.projectDir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| waitForDebugger: _liveSyncInfo?.waitForDebugger, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } as Mobile.IStartApplicationData); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public async shouldRestart( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -45,8 +55,8 @@ export class WindowsDeviceLiveSyncService | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const localToDevicePathData of localToDevicePaths) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const devicePath = localToDevicePathData.getDevicePath(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (require("fs").existsSync(devicePath)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| require("fs").unlinkSync(devicePath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (fs.existsSync(devicePath)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fs.unlinkSync(devicePath); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+80
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. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🛡️ Proposed fix for (const localToDevicePathData of localToDevicePaths) {
const devicePath = localToDevicePathData.getDevicePath();
- if (fs.existsSync(devicePath)) {
- fs.unlinkSync(devicePath);
- }
+ try {
+ if (fs.existsSync(devicePath)) {
+ fs.unlinkSync(devicePath);
+ }
+ } catch (err) {
+ this.$logger.trace(
+ `[Windows LiveSync] Failed to remove ${devicePath}: ${err}`,
+ );
+ }
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: NativeScript/nativescript-cli
Length of output: 6243
🏁 Script executed:
Repository: NativeScript/nativescript-cli
Length of output: 41640
Escape the PowerShell command arguments here and in the related uninstall/resolve/stop paths.
packageFilePath,appIdentifier, andprojectNameare interpolated directly into-Commandstrings, so a quote or$(...)in one of those values can break out of the literal and be interpreted by PowerShell. Pass parameters out-of-band or escape the literals before building the command.🤖 Prompt for AI Agents
Source: Linters/SAST tools