Stopping debug session now stops the tasks
This commit is contained in:
parent
97909483d4
commit
55f484cf70
7
.vscode/launch.json
vendored
7
.vscode/launch.json
vendored
@ -6,7 +6,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Debug React App",
|
"name": "Debug React App",
|
||||||
"type": "chrome",
|
"type": "pwa-chrome",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"url": "http://localhost:3001",
|
"url": "http://localhost:3001",
|
||||||
"webRoot": "${workspaceFolder}/src",
|
"webRoot": "${workspaceFolder}/src",
|
||||||
@ -15,11 +15,12 @@
|
|||||||
"--remote-debugging-port=9222",
|
"--remote-debugging-port=9222",
|
||||||
"--user-data-dir=C:\\ChromeDebug"
|
"--user-data-dir=C:\\ChromeDebug"
|
||||||
],
|
],
|
||||||
"preLaunchTask": "Start All"
|
"preLaunchTask": "Start All",
|
||||||
|
"postDebugTask": "Stop All Tasks"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Attach to Chrome",
|
"name": "Attach to Chrome",
|
||||||
"type": "chrome",
|
"type": "pwa-chrome",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"port": 9222,
|
"port": 9222,
|
||||||
"webRoot": "${workspaceFolder}/src"
|
"webRoot": "${workspaceFolder}/src"
|
||||||
|
|||||||
39
.vscode/tasks.json
vendored
39
.vscode/tasks.json
vendored
@ -3,13 +3,15 @@
|
|||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "Start Proxy",
|
"label": "Start Proxy",
|
||||||
"type": "shell",
|
"type": "process",
|
||||||
"command": "./proxy.cmd",
|
"command": "./proxy.cmd",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
"problemMatcher": {
|
"runOptions": {
|
||||||
"pattern": {
|
"reevaluateOnRerun": true,
|
||||||
"regexp": ".*"
|
"terminateOnExit": true
|
||||||
},
|
},
|
||||||
|
"problemMatcher": {
|
||||||
|
"pattern": { "regexp": ".*" },
|
||||||
"background": {
|
"background": {
|
||||||
"activeOnStart": true,
|
"activeOnStart": true,
|
||||||
"beginsPattern": "^.*",
|
"beginsPattern": "^.*",
|
||||||
@ -19,18 +21,21 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Start CRA",
|
"label": "Start CRA",
|
||||||
"type": "shell",
|
"type": "process",
|
||||||
"command": "npm start",
|
"command": "npm",
|
||||||
|
"args": ["start"],
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
|
"runOptions": {
|
||||||
|
"reevaluateOnRerun": true,
|
||||||
|
"terminateOnExit": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"env": {
|
"env": {
|
||||||
"BROWSER": "none"
|
"BROWSER": "none"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"pattern": {
|
"pattern": { "regexp": ".*" },
|
||||||
"regexp": ".*"
|
|
||||||
},
|
|
||||||
"background": {
|
"background": {
|
||||||
"activeOnStart": true,
|
"activeOnStart": true,
|
||||||
"beginsPattern": "^.*",
|
"beginsPattern": "^.*",
|
||||||
@ -42,6 +47,22 @@
|
|||||||
"label": "Start All",
|
"label": "Start All",
|
||||||
"dependsOn": ["Start Proxy", "Start CRA"],
|
"dependsOn": ["Start Proxy", "Start CRA"],
|
||||||
"dependsOrder": "parallel"
|
"dependsOrder": "parallel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Stop All Tasks",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "powershell",
|
||||||
|
"args": [
|
||||||
|
"-ExecutionPolicy",
|
||||||
|
"Bypass",
|
||||||
|
"-File",
|
||||||
|
"${workspaceFolder}/stop-tasks.ps1"
|
||||||
|
],
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "dedicated"
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
23
stop-tasks.ps1
Normal file
23
stop-tasks.ps1
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Stop all tasks started by VS Code debugging
|
||||||
|
Write-Host "Stopping development tasks..."
|
||||||
|
|
||||||
|
# Find and stop processes by command line
|
||||||
|
$processes = Get-WmiObject Win32_Process | Where-Object {
|
||||||
|
($_.CommandLine -like '*proxy.cmd*') -or
|
||||||
|
($_.CommandLine -like '*npm*start*') -or
|
||||||
|
($_.CommandLine -like '*react-scripts*')
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($proc in $processes) {
|
||||||
|
Write-Host "Stopping process $($proc.ProcessId): $($proc.Name)"
|
||||||
|
Stop-Process -Id $proc.ProcessId -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Also stop child processes
|
||||||
|
$children = Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq $proc.ProcessId }
|
||||||
|
foreach ($child in $children) {
|
||||||
|
Write-Host "Stopping child process $($child.ProcessId): $($child.Name)"
|
||||||
|
Stop-Process -Id $child.ProcessId -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Tasks stopped"
|
||||||
Loading…
Reference in New Issue
Block a user